Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat([rich-text-editor-for-prose-stage-replace-plain]): share Writers Room prose editor with the prose stage
[._.]/ Adam Eivy4fddb3e263f0
diff --git a/client/src/components/pipeline/stages/ProseStage.jsx b/client/src/components/pipeline/stages/ProseStage.jsxindex 005386dc8c..231a6bcc3e 100644--- a/client/src/components/pipeline/stages/ProseStage.jsx+++ b/client/src/components/pipeline/stages/ProseStage.jsx@@ -8,6 +8,7 @@ export default function ProseStage(props) {{...props}stageId="prose"generateLabel="Draft prose"+ proseEditoroutputPlaceholder="An 800–1500 word short-story draft for this issue. Will be lightly structured with `## Scene N — Slugline` H2 markers so the comic and teleplay stages have stable anchors."/>);diff --git a/client/src/components/pipeline/stages/TextStagePanel.jsx b/client/src/components/pipeline/stages/TextStagePanel.jsxindex 906a54ade2..0a28e6df0c 100644--- a/client/src/components/pipeline/stages/TextStagePanel.jsx+++ b/client/src/components/pipeline/stages/TextStagePanel.jsx@@ -8,6 +8,7 @@import { useEffect, useMemo, useState } from 'react';import { Loader2, Sparkles, Save, History } from 'lucide-react';import toast from '../../ui/Toast';+import ProseEditor from '../../ui/ProseEditor';import {generatePipelineStage, updatePipelineIssue,PIPELINE_STAGE_LABELS,@@ -31,6 +32,10 @@ export default function TextStagePanel({generateLabel = 'Generate',extraActions = null,actionsGated = false,+ // The prose stage opts into the shared reading-comfortable <ProseEditor>+ // (serif, spellcheck) for its output; the script-shaped stages keep the+ // mono textarea that suits slugline/panel markup.+ proseEditor = false,}) {const stage = issue.stages?.[stageId] || { status: 'empty', input: '', output: '', runHistory: [] };const [draftOutput, setDraftOutput] = useState(stage.output || '');@@ -200,13 +205,23 @@ export default function TextStagePanel({<label className="block"><span className="block text-xs uppercase tracking-wider text-gray-500 mb-1">Output</span>- <textarea- value={draftOutput}- onChange={(e) => setDraftOutput(e.target.value)}- placeholder={outputPlaceholder}- rows={24}- className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white text-sm font-mono leading-relaxed"- />+ {proseEditor ? (+ <ProseEditor+ value={draftOutput}+ onChange={(e) => setDraftOutput(e.target.value)}+ placeholder={outputPlaceholder}+ rows={24}+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white text-sm"+ />+ ) : (+ <textarea+ value={draftOutput}+ onChange={(e) => setDraftOutput(e.target.value)}+ placeholder={outputPlaceholder}+ rows={24}+ className="w-full px-3 py-2 bg-port-bg border border-port-border rounded text-white text-sm font-mono leading-relaxed"+ />+ )}</label>{stage.errorMessage ? (diff --git a/client/src/components/ui/ProseEditor.jsx b/client/src/components/ui/ProseEditor.jsxnew file mode 100644index 0000000000..f3b8fd76fd--- /dev/null+++ b/client/src/components/ui/ProseEditor.jsx@@ -0,0 +1,44 @@+import { forwardRef } from 'react';++// Shared prose-writing textarea — the Writers Room editing surface lifted out+// so other prose surfaces (the pipeline prose stage) get the same reading-+// comfortable feel: a serif face, relaxed leading, spellcheck, and a heading-+// hint placeholder, instead of the code-style mono textarea the script-shaped+// text stages use. Plain text in/out — the value is a markdown string, exactly+// as a bare <textarea> would produce, so nothing downstream changes.+//+// This component owns ONLY the prose typography (serif + leading) + spellcheck+// + the optional light "reading paper" theme. Host chrome — width, height,+// border, background, padding, text size, rows — comes through `className` (and+// any other passthrough props), so each caller keeps its own frame.++const DEFAULT_PLACEHOLDER = 'Start writing… Use # Chapter, ## Scene, ### Beat headings to outline.';++const ProseEditor = forwardRef(function ProseEditor({+ value,+ onChange,+ placeholder = DEFAULT_PLACEHOLDER,+ readingTheme = 'dark',+ className = '',+ spellCheck = true,+ ...rest+}, ref) {+ return (+ <textarea+ ref={ref}+ value={value}+ onChange={onChange}+ placeholder={placeholder}+ spellCheck={spellCheck}+ // The light reading theme paints the textarea like paper; dark (default)+ // inherits the surrounding surface, so no inline style is needed.+ style={readingTheme === 'light'+ ? { '--port-input-bg': 'var(--wr-reading-paper)', color: '#1a1a1a' }+ : undefined}+ className={`font-serif leading-relaxed focus:outline-none ${className}`.trim()}+ {...rest}+ />+ );+});++export default ProseEditor;diff --git a/client/src/components/ui/ProseEditor.test.jsx b/client/src/components/ui/ProseEditor.test.jsxnew file mode 100644index 0000000000..220424e358--- /dev/null+++ b/client/src/components/ui/ProseEditor.test.jsx@@ -0,0 +1,61 @@+import { describe, it, expect, vi } from 'vitest';+import { createRef } from 'react';+import { render, screen, fireEvent } from '@testing-library/react';++import ProseEditor from './ProseEditor';++describe('ProseEditor', () => {+ it('renders a serif, relaxed-leading, spellchecked textarea', () => {+ render(<ProseEditor value="hello" onChange={() => {}} />);+ const ta = screen.getByRole('textbox');+ expect(ta.className).toContain('font-serif');+ expect(ta.className).toContain('leading-relaxed');+ expect(ta.getAttribute('spellcheck')).toBe('true');+ expect(ta.value).toBe('hello');+ });++ it('uses the heading-hint placeholder by default and lets callers override it', () => {+ const { rerender } = render(<ProseEditor value="" onChange={() => {}} />);+ expect(screen.getByPlaceholderText(/# Chapter, ## Scene, ### Beat/)).toBeTruthy();+ rerender(<ProseEditor value="" onChange={() => {}} placeholder="Draft here" />);+ expect(screen.getByPlaceholderText('Draft here')).toBeTruthy();+ });++ it('forwards onChange events', () => {+ const onChange = vi.fn();+ render(<ProseEditor value="" onChange={onChange} />);+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'x' } });+ expect(onChange).toHaveBeenCalledTimes(1);+ });++ it('merges passthrough className after the baked-in prose classes', () => {+ render(<ProseEditor value="" onChange={() => {}} className="w-full px-6 text-base" />);+ const ta = screen.getByRole('textbox');+ expect(ta.className).toContain('font-serif');+ expect(ta.className).toContain('w-full');+ expect(ta.className).toContain('text-base');+ });++ it('forwards arbitrary textarea props (rows) and a ref', () => {+ const ref = createRef();+ render(<ProseEditor ref={ref} value="" onChange={() => {}} rows={24} />);+ const ta = screen.getByRole('textbox');+ expect(ta.getAttribute('rows')).toBe('24');+ expect(ref.current).toBe(ta);+ });++ it('paints the paper background only for the light reading theme', () => {+ const { rerender } = render(<ProseEditor value="" onChange={() => {}} readingTheme="light" />);+ let ta = screen.getByRole('textbox');+ expect(ta.style.getPropertyValue('--port-input-bg')).toBe('var(--wr-reading-paper)');++ rerender(<ProseEditor value="" onChange={() => {}} readingTheme="dark" />);+ ta = screen.getByRole('textbox');+ expect(ta.style.getPropertyValue('--port-input-bg')).toBe('');+ });++ it('allows spellCheck to be disabled', () => {+ render(<ProseEditor value="" onChange={() => {}} spellCheck={false} />);+ expect(screen.getByRole('textbox').getAttribute('spellcheck')).toBe('false');+ });+});diff --git a/client/src/components/writers-room/WorkEditor.jsx b/client/src/components/writers-room/WorkEditor.jsxindex acf680a715..92fa4ed348 100644--- a/client/src/components/writers-room/WorkEditor.jsx+++ b/client/src/components/writers-room/WorkEditor.jsx@@ -23,6 +23,7 @@ import {ExternalLink,} from 'lucide-react';import toast from '../ui/Toast';+import ProseEditor from '../ui/ProseEditor';import Drawer from '../Drawer';import useMounted from '../../hooks/useMounted';import useClickOutside from '../../hooks/useClickOutside';@@ -803,16 +804,12 @@ export default function WorkEditor({ work, onChange, onToggleExercise, exerciseO/></div>) : (- <textarea+ <ProseEditorref={textareaRef}value={body}onChange={(e) => setBody(e.target.value)}- placeholder="Start writing… Use # Chapter, ## Scene, ### Beat headings to outline."- style={readingTheme === 'light'- ? { '--port-input-bg': 'var(--wr-reading-paper)', color: '#1a1a1a' }- : undefined}- className="w-full h-full resize-none px-6 py-6 font-serif text-base leading-relaxed focus:outline-none"- spellCheck+ readingTheme={readingTheme}+ className="w-full h-full resize-none px-6 py-6 text-base"/>)}<div