[PR #8252] [MERGED] feat(illustrator): give image prompts the current Maps location #8564

Closed
opened 2026-11-07 16:45:34 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: feat/illustrator-current-location


📝 Commits (3)

  • d70dbf6 feat(illustrator): give image prompts the current Maps location
  • badbfd5 fix(illustrator): read the map location after the reply for post-reply agents
  • cc2fe26 fix(illustrator): pass the post-reply location to automatic post-processing agents

📊 Changes

9 files changed (+191 additions, -5 deletions)

View changed files

📝 packages/server/src/routes/generate.routes.ts (+12 -2)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+2 -0)
📝 packages/server/src/services/agents/agent-executor.ts (+28 -0)
📝 packages/server/src/services/agents/agent-pipeline.ts (+3 -0)
📝 packages/server/src/services/generation/illustrator-manual-prompt-generation.ts (+5 -2)
📝 packages/server/src/services/spatial-context/projection.ts (+14 -1)
📝 packages/shared/src/types/agent.ts (+5 -0)
📝 scripts/regressions/agent-runtime.regression.ts (+22 -0)
📝 scripts/regressions/prompt.regression.ts (+100 -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 #8251

Why this change

  • In a Roleplay chat with Maps on, the narrator gets the current location's path and public description. The Illustrator only got the location's reference image.
  • The prompt writer never sees that image: it goes straight to the image model. So the writer guessed the background.
  • Image models without reference support drop the image entirely. NovelAI Diffusion V5 does today: precise reference requires a V4.5 model, got nai-diffusion-5-full.

What changed

  • AgentContext.currentLocation (shared type, optional): the Roleplay location's breadcrumb path and public description. Set from the already-resolved location in generate.routes.ts and in buildRetryAgentContext (retries and the Gallery Illustration button) via agentCurrentLocationFromProjection.
  • One shared <current_location> block, buildAgentCurrentLocationBlock in agent-executor.ts:
    • automatic runs add it right after <current_game_state>, for image-capable agents only;
    • the manual writer ([illustrate:] commands, Gallery button) adds it before the lore block.
  • Gated by the Illustrator's existing "Tracker data" Context Source. No new toggle or UI.
  • Left out on purpose:
    • location IDs, destinations and the known-locations list (travel data, ~1k tokens);
    • "Private model memory" (narrator-only secrets, not visual).
  • Scope: game mode and non-image agents are unchanged.

The block:

<current_location>
The story's current location, from the chat's map. Use it for the image's setting and background. If it contradicts the scene, the scene wins: treat it as outdated and ignore it.
Path: The White Wood > Aldonia > Upper Tier > Royal Palace of Aldonia > Throne Room
Description: A vaulted white hall where Queen Arceana holds court. …
</current_location>

Location after the reply. The narrator's map move is committed before post-reply agents run. So the route reads the location once more for them (postReplySpatialProjection), the same way game mode already reads it again after the reply. Automatic post-processing runs get it through a new currentLocation override on pipeline.postGenerate, built the same way as the existing decisions override, because the pipeline otherwise keeps its pre-reply context. The automatic Illustrator, [illustrate:] commands and their location reference image all see where the story is now, not where the turn started. Before this, the [illustrate:] reference image used the turn-start location, so a narrator move in the same reply attached the previous room's artwork. Retries and the Gallery button read the location at the retried message.

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

  • Local runs: pnpm check exit 0. Regressions: prompt (all tests, including the new one), spatial-context, world-one-place, agent-runtime 2/2, illustrator-character-prompts, agent-connection-parameters, all passing.
  • New regression (prompt.regression.ts), "Illustrator prompts carry the current Maps location under Tracker data (#8251)", covers:
    • the projection helper (Roleplay, game, none);
    • that the block carries no IDs, destinations or private memory;
    • the automatic Illustrator with Tracker data on and off;
    • that a non-image agent never gets it;
    • the manual writer with Tracker data on and off.
  • Removing either the automatic or the manual wiring makes the new test fail.
  • agent-runtime.regression.ts: postGenerate with a currentLocation override sends the new room, and without one keeps the pipeline's own. Removing the override makes it fail.
  • To verify in the browser: in a Roleplay chat with Maps on, stand in a location with a public description. With the Illustrator added and agent debug logging on, trigger an [illustrate: ...] command. The [debug/illustrator/manual-illustration-prompt] messages log should contain <current_location> with the path and description.
  • Turning off "Tracker data" in the Illustrator's Context Sources should remove the block from the next call.
  • An automatic Illustrator run and the Gallery Illustration button should carry the block too.

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)

No UI change. Server-side prompt assembly only.

🤖 Generated with Claude Code


🔄 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/8252 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ylli-selmani](https://github.com/ylli-selmani) **Base:** `staging` ← **Head:** `feat/illustrator-current-location` --- ### 📝 Commits (3) - [`d70dbf6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d70dbf69e7fb3d4e8da69311cebb4244e909bae7) feat(illustrator): give image prompts the current Maps location - [`badbfd5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/badbfd501ad1429699b4eb4042c04c330b9e654b) fix(illustrator): read the map location after the reply for post-reply agents - [`cc2fe26`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cc2fe26a927759060e86f3d695aab2ca78811653) fix(illustrator): pass the post-reply location to automatic post-processing agents ### 📊 Changes **9 files changed** (+191 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/generate.routes.ts` (+12 -2) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+2 -0) 📝 `packages/server/src/services/agents/agent-executor.ts` (+28 -0) 📝 `packages/server/src/services/agents/agent-pipeline.ts` (+3 -0) 📝 `packages/server/src/services/generation/illustrator-manual-prompt-generation.ts` (+5 -2) 📝 `packages/server/src/services/spatial-context/projection.ts` (+14 -1) 📝 `packages/shared/src/types/agent.ts` (+5 -0) 📝 `scripts/regressions/agent-runtime.regression.ts` (+22 -0) 📝 `scripts/regressions/prompt.regression.ts` (+100 -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 #8251 ## Why this change - In a Roleplay chat with Maps on, the narrator gets the current location's path and public description. The Illustrator only got the location's reference image. - The prompt writer never sees that image: it goes straight to the image model. So the writer guessed the background. - Image models without reference support drop the image entirely. NovelAI Diffusion V5 does today: `precise reference requires a V4.5 model, got nai-diffusion-5-full`. ## What changed - **`AgentContext.currentLocation`** (shared type, optional): the Roleplay location's breadcrumb path and public description. Set from the already-resolved location in `generate.routes.ts` and in `buildRetryAgentContext` (retries and the Gallery Illustration button) via `agentCurrentLocationFromProjection`. - **One shared `<current_location>` block**, `buildAgentCurrentLocationBlock` in `agent-executor.ts`: - automatic runs add it right after `<current_game_state>`, for image-capable agents only; - the manual writer (`[illustrate:]` commands, Gallery button) adds it before the lore block. - **Gated by the Illustrator's existing "Tracker data" Context Source.** No new toggle or UI. - **Left out on purpose:** - location IDs, destinations and the known-locations list (travel data, ~1k tokens); - "Private model memory" (narrator-only secrets, not visual). - **Scope:** game mode and non-image agents are unchanged. The block: ``` <current_location> The story's current location, from the chat's map. Use it for the image's setting and background. If it contradicts the scene, the scene wins: treat it as outdated and ignore it. Path: The White Wood > Aldonia > Upper Tier > Royal Palace of Aldonia > Throne Room Description: A vaulted white hall where Queen Arceana holds court. … </current_location> ``` **Location after the reply.** The narrator's map move is committed before post-reply agents run. So the route reads the location once more for them (`postReplySpatialProjection`), the same way game mode already reads it again after the reply. Automatic post-processing runs get it through a new `currentLocation` override on `pipeline.postGenerate`, built the same way as the existing `decisions` override, because the pipeline otherwise keeps its pre-reply context. The automatic Illustrator, `[illustrate:]` commands and their location reference image all see where the story is *now*, not where the turn started. Before this, the `[illustrate:]` reference image used the turn-start location, so a narrator move in the same reply attached the previous room's artwork. Retries and the Gallery button read the location at the retried message. ## 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 - Local runs: `pnpm check` exit 0. Regressions: `prompt` (all tests, including the new one), `spatial-context`, `world-one-place`, `agent-runtime` 2/2, `illustrator-character-prompts`, `agent-connection-parameters`, all passing. - New regression (`prompt.regression.ts`), "Illustrator prompts carry the current Maps location under Tracker data (#8251)", covers: - the projection helper (Roleplay, game, none); - that the block carries no IDs, destinations or private memory; - the automatic Illustrator with Tracker data on and off; - that a non-image agent never gets it; - the manual writer with Tracker data on and off. - Removing either the automatic or the manual wiring makes the new test fail. - `agent-runtime.regression.ts`: `postGenerate` with a `currentLocation` override sends the new room, and without one keeps the pipeline's own. Removing the override makes it fail. - To verify in the browser: in a Roleplay chat with Maps on, stand in a location with a public description. With the Illustrator added and agent debug logging on, trigger an `[illustrate: ...]` command. The `[debug/illustrator/manual-illustration-prompt] messages` log should contain `<current_location>` with the path and description. - Turning off "Tracker data" in the Illustrator's Context Sources should remove the block from the next call. - An automatic Illustrator run and the Gallery Illustration button should carry the block too. ## 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) No UI change. Server-side prompt assembly only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:45:34 +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#8564
No description provided.