[PR #8341] [MERGED] feat(packages): open a connection from a Home tab and log raw generation prompts (capability API 1.386) #8305

Closed
opened 2026-10-27 06:07:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8341
Author: @SpicyMarinara
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/story-writer-host


📝 Commits (6)

  • e9cbd2b feat(packages): open a connection from a Home tab, and log raw generation prompts (capability API 1.386)
  • 9f4d161 Merge staging into StoryWriter host integration
  • 4330831 fix(generate): stop a raw run when its client leaves
  • 236bfa1 fix(packages): address local review of the Story Writer host change
  • e45386a fix(packages): return to the package tab only when its connection editor closes
  • 54e6848 fix(packages): keep the package return tab through editor switches and Back

📊 Changes

10 files changed (+351 additions, -18 deletions)

View changed files

📝 docs/agents/built-in-agents.md (+10 -0)
📝 docs/development/optional-agent-packages.md (+35 -0)
📝 packages/client/src/components/chat/HomeBrowserHub.tsx (+9 -0)
📝 packages/client/src/lib/back-layers.ts (+2 -0)
📝 packages/client/src/stores/ui.store.ts (+16 -2)
📝 packages/server/src/routes/generate/raw-route.ts (+41 -10)
📝 packages/shared/src/schemas/capability-package.schema.ts (+2 -1)
📝 scripts/regressions/capability-package-chat-controls.regression.ts (+60 -0)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+6 -5)
➕ scripts/regressions/raw-generation-debug.regression.ts (+170 -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 #8332

Package side: Pasta-Devs/Marinara-Agents#1704 (Story Writer, Pasta-Devs/Marinara-Agents#1703).

Why this change

  • Story Writer is a new downloadable experience for writing long stories and fanfiction with the model, on its own Home tab. It has an Edit connection button so the author can change the model or its parameters. On desktop the connection editor replaces Home, and when it closed, Home came back on the Home tab instead of the package the author was writing in.
  • Story Writer streams chapters through the existing POST /api/generate/raw route. That route never logged the final prompt in debug mode, so its prompts were invisible. AGENTS.md requires prompt logging for every generation path.

What changed

  • A package on a Home tab can now open a saved connection in the connection editor. When the editor closes, Home comes back to that package's tab instead of the Home dashboard.
  • With debug mode on (or DEBUG_AGENTS), raw generation requests log the final messages sent to the provider and the reply. They never log the connection's key or address. Requests without debug mode log nothing new.
  • Leaving a raw generation now stops it, for example by reloading or closing the tab. The route listened on the request stream, which has already closed by then, so the provider kept generating for nobody. It now listens on the reply, like /raw/embeddings, and a regression covers the streaming and plain paths.
  • Capability API is now 1.386. #8334 (1.385, gallery image saving) has merged, and staging is merged into this branch with both entries kept.
  • The package developer guide documents openConnection, how browser packages use /api/generate/raw, and its debugMode field. The downloadable agents reference gets a Story Writer entry.

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

Commands run by the agent, for the reviewer to repeat:

  • pnpm check (exit 0; its one lint warning is pre-existing in HomeProfessorMariChat.tsx, untouched here).
  • node ./scripts/run-regressions.mjs --filter scripts/regressions/raw-generation-debug.regression.ts: passed. With the old request-stream listener restored, the new disconnect case fails (the abandoned provider call never ends).
  • node ./scripts/run-regressions.mjs --filter scripts/regressions/capability-package-chat-controls.regression.ts: passed.
  • node ./scripts/run-regressions.mjs --filter scripts/regressions/capability-package-lifecycle.regression.ts: passed, and so does marinara-host-namespace after merging staging.
  • The Story Writer Playwright suite (Marinara-Agents tests/package-story-writer.e2e.ts, desktop and phone) ran against this branch. It covers clicking Edit connection, closing the editor and landing back on the Story Writer tab.

To verify by hand:

  • Manually verify in the browser, on desktop: open Home → Story Writer, click Edit connection in its sidebar, then close the connection editor. Home should reopen on the Story Writer tab, not the Home dashboard.
  • Manually verify the same on a phone-sized window, where the editor opens as an overlay.
  • Manually verify that reloading the page while Story Writer writes a chapter stops the provider request (watch the provider's dashboard or a local server's log).
  • Manually verify with Settings → Debug mode on that writing a chapter logs [debug/raw] prompt for … and [debug/raw] response for … in the server log, and that nothing new is logged with debug mode off.

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)

Changed docs: docs/development/optional-agent-packages.md and docs/agents/built-in-agents.md. Translations are tracked in the [docs-i18n] follow-up #8342.

🤖 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/8341 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/story-writer-host` --- ### 📝 Commits (6) - [`e9cbd2b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e9cbd2bb9d42223483c8994727df140f3227660b) feat(packages): open a connection from a Home tab, and log raw generation prompts (capability API 1.386) - [`9f4d161`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9f4d1613f7393fa79b64e318c98772cdac0cd2dc) Merge staging into StoryWriter host integration - [`4330831`](https://github.com/Pasta-Devs/Marinara-Engine/commit/43308312850770da0117a1aaf37d2bdcbe249329) fix(generate): stop a raw run when its client leaves - [`236bfa1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/236bfa1c69f1a88c6ec9c96d59287a210bf9538a) fix(packages): address local review of the Story Writer host change - [`e45386a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e45386a5e8133836079139548bb585aa668ab73d) fix(packages): return to the package tab only when its connection editor closes - [`54e6848`](https://github.com/Pasta-Devs/Marinara-Engine/commit/54e6848c818ae4150f108ab9614986bb7610891d) fix(packages): keep the package return tab through editor switches and Back ### 📊 Changes **10 files changed** (+351 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `docs/agents/built-in-agents.md` (+10 -0) 📝 `docs/development/optional-agent-packages.md` (+35 -0) 📝 `packages/client/src/components/chat/HomeBrowserHub.tsx` (+9 -0) 📝 `packages/client/src/lib/back-layers.ts` (+2 -0) 📝 `packages/client/src/stores/ui.store.ts` (+16 -2) 📝 `packages/server/src/routes/generate/raw-route.ts` (+41 -10) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+2 -1) 📝 `scripts/regressions/capability-package-chat-controls.regression.ts` (+60 -0) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+6 -5) ➕ `scripts/regressions/raw-generation-debug.regression.ts` (+170 -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 #8332 Package side: Pasta-Devs/Marinara-Agents#1704 (Story Writer, Pasta-Devs/Marinara-Agents#1703). ## Why this change - **Story Writer** is a new downloadable experience for writing long stories and fanfiction with the model, on its own Home tab. It has an **Edit connection** button so the author can change the model or its parameters. On desktop the connection editor replaces Home, and when it closed, Home came back on the **Home** tab instead of the package the author was writing in. - Story Writer streams chapters through the existing `POST /api/generate/raw` route. That route never logged the final prompt in debug mode, so its prompts were invisible. AGENTS.md requires prompt logging for every generation path. ## What changed - A package on a Home tab can now open a saved connection in the connection editor. When the editor closes, Home comes back to that package's tab instead of the Home dashboard. - With debug mode on (or `DEBUG_AGENTS`), raw generation requests log the final messages sent to the provider and the reply. They never log the connection's key or address. Requests without debug mode log nothing new. - Leaving a raw generation now stops it, for example by reloading or closing the tab. The route listened on the request stream, which has already closed by then, so the provider kept generating for nobody. It now listens on the reply, like `/raw/embeddings`, and a regression covers the streaming and plain paths. - Capability API is now **1.386**. #8334 (1.385, gallery image saving) has merged, and staging is merged into this branch with both entries kept. - The package developer guide documents `openConnection`, how browser packages use `/api/generate/raw`, and its `debugMode` field. The downloadable agents reference gets a **Story Writer** entry. ## 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 Commands run by the agent, for the reviewer to repeat: - `pnpm check` (exit 0; its one lint warning is pre-existing in `HomeProfessorMariChat.tsx`, untouched here). - `node ./scripts/run-regressions.mjs --filter scripts/regressions/raw-generation-debug.regression.ts`: passed. With the old request-stream listener restored, the new disconnect case fails (the abandoned provider call never ends). - `node ./scripts/run-regressions.mjs --filter scripts/regressions/capability-package-chat-controls.regression.ts`: passed. - `node ./scripts/run-regressions.mjs --filter scripts/regressions/capability-package-lifecycle.regression.ts`: passed, and so does `marinara-host-namespace` after merging staging. - The Story Writer Playwright suite (Marinara-Agents `tests/package-story-writer.e2e.ts`, desktop and phone) ran against this branch. It covers clicking **Edit connection**, closing the editor and landing back on the Story Writer tab. To verify by hand: - Manually verify in the browser, on desktop: open **Home → Story Writer**, click **Edit connection** in its sidebar, then close the connection editor. Home should reopen on the **Story Writer** tab, not the Home dashboard. - Manually verify the same on a phone-sized window, where the editor opens as an overlay. - Manually verify that reloading the page while Story Writer writes a chapter stops the provider request (watch the provider's dashboard or a local server's log). - Manually verify with **Settings → Debug mode** on that writing a chapter logs `[debug/raw] prompt for …` and `[debug/raw] response for …` in the server log, and that nothing new is logged with debug mode off. ## 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) Changed docs: `docs/development/optional-agent-packages.md` and `docs/agents/built-in-agents.md`. Translations are tracked in the `[docs-i18n]` follow-up #8342. 🤖 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-10-27 06:07:31 +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#8305
No description provided.