Skip to content

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

feat([importer-screenplay-teleplay-seed]): seed screenplay imports into stages.teleplay

[._.]/ Adam Eivy384628f4cf4f
diff --git a/client/src/pages/Importer.jsx b/client/src/pages/Importer.jsx
index ae7a03624d..94f7e11439 100644
--- a/client/src/pages/Importer.jsx
+++ b/client/src/pages/Importer.jsx
@@ -27,6 +27,17 @@ const CONTENT_TYPE_LABELS = {
'comic-script': 'Comic Script',
};
+// Mirrors the server's CONTENT_TYPE_SEED_STAGE (server/services/importer.js):
+// a script-form content type seeds its matching script stage (ready) instead
+// of prose. Drives the Review-panel copy + per-issue excerpt label so they
+// name the stage the verbatim excerpt actually lands in.
+const SEED_STAGE_DISPLAY = {
+ 'comic-script': { stagePath: 'stages.comicScript.output', excerptLabel: 'Comic script excerpt' },
+ 'screenplay': { stagePath: 'stages.teleplay.output', excerptLabel: 'Screenplay excerpt' },
+};
+const DEFAULT_SEED_STAGE_DISPLAY = { stagePath: 'stages.prose.output', excerptLabel: 'Prose excerpt' };
+const seedStageDisplayFor = (contentType) => SEED_STAGE_DISPLAY[contentType] || DEFAULT_SEED_STAGE_DISPLAY;
+
// Whitelist of arc fields forwarded to the commit endpoint. The wire schema
// (`importerArcShape`) is `.passthrough()` today and `sanitizeArc` ignores
// unknowns, but `arcDraft` starts as a shallow clone of the LLM's arc
@@ -274,8 +285,9 @@ export default function Importer() {
seriesId: preview.series.id,
issues: issuesDraft,
// Routes the verbatim excerpt to the right stage server-side — a
- // comic-script import seeds stages.comicScript (ready) so the pipeline
- // renders the user's script as-is instead of regenerating it.
+ // script-form import (comic-script → comicScript, screenplay → teleplay)
+ // seeds that script stage (ready) so the pipeline renders the user's
+ // script as-is instead of regenerating it.
contentType: intake.contentType,
};
const payload = arcAlreadyPersisted
@@ -686,10 +698,10 @@ function ReviewPanel({
});
};
- // A comic-script import seeds the verbatim excerpt into stages.comicScript
- // (not stages.prose) — keep the Review copy + per-issue label accurate.
- const isComic = contentType === 'comic-script';
- const excerptLabel = isComic ? 'Comic script excerpt' : 'Prose excerpt';
+ // A script-form import (comic-script → comicScript, screenplay → teleplay)
+ // seeds the verbatim excerpt into its script stage, not stages.prose — keep
+ // the Review copy + per-issue label accurate to the actual seed stage.
+ const { stagePath: seedStagePath, excerptLabel } = seedStageDisplayFor(contentType);
return (
<div className="space-y-6">
@@ -706,7 +718,7 @@ function ReviewPanel({
<p className="text-xs text-port-text-muted mt-1">
Review the canon below, edit any issue titles or synopses, then click Commit to seed
the pipeline. The verbatim excerpt for each issue lands in{' '}
- <code>{isComic ? 'stages.comicScript.output' : 'stages.prose.output'}</code>.
+ <code>{seedStagePath}</code>.
</p>
{preview.isExistingSeries && (
<label className={`text-xs mt-2 flex items-center gap-2 cursor-pointer ${replaceMode ? 'text-port-error' : 'text-port-text-muted'}`}>
diff --git a/server/services/importer.js b/server/services/importer.js
index 936e447a74..b4473a0ff5 100644
--- a/server/services/importer.js
+++ b/server/services/importer.js
@@ -94,11 +94,14 @@ const DEFAULT_TARGET_ISSUE_COUNT_HINT = Object.freeze({
// Which text stage an issue's verbatim excerpt seeds at commit. A content type
// that is ALREADY in a script form seeds that script stage (ready) so the
// pipeline renders the user's verbatim text instead of regenerating it; prose
-// types seed `stages.prose`. One table row per new structured type — e.g.
-// screenplay → 'teleplay' is the queued follow-up (PLAN.md
-// [importer-screenplay-teleplay-seed]).
+// types seed `stages.prose`. One table row per structured type. The scene
+// extractor (`extractScenes`) already adapts a verbatim teleplay into
+// storyboards via the `pipeline-extract-scenes` prompt, so a screenplay needs
+// no parser work — unlike the comic path, which had to teach `parseComicScript`
+// the bare PAGE/PANEL form.
const CONTENT_TYPE_SEED_STAGE = Object.freeze({
'comic-script': 'comicScript',
+ 'screenplay': 'teleplay',
});
const DEFAULT_SEED_STAGE = 'prose';
const seedStageFor = (contentType) => CONTENT_TYPE_SEED_STAGE[contentType] || DEFAULT_SEED_STAGE;
diff --git a/server/services/importer.test.js b/server/services/importer.test.js
index 67997e8c69..9cfc75cdab 100644
--- a/server/services/importer.test.js
+++ b/server/services/importer.test.js
@@ -895,6 +895,26 @@ describe('commitImport', () => {
expect(issue.stages.prose?.output).toBeFalsy();
});
+ it('seeds stages.teleplay (not prose) for a screenplay import', async () => {
+ // A screenplay source is already script-form, so its verbatim excerpt
+ // must land in teleplay (ready) — seeding prose would make the pipeline
+ // regenerate it. Downstream scene extraction already consumes teleplay.
+ const { uni, ser } = await setupForCommit();
+ const script = 'INT. VAULT - NIGHT\n\nARIA\nWho left this here?\n\nFADE OUT.';
+ const result = await importerSvc.commitImport({
+ universeId: uni.id,
+ seriesId: ser.id,
+ contentType: 'screenplay',
+ canonSelections: { characters: [], places: [], objects: [] },
+ issues: [{ title: 'Issue 1', arcPosition: 1, proseExcerpt: script }],
+ });
+ const issue = await issuesSvc.getIssue(result.createdIssueIds[0]);
+ expect(issue.stages.teleplay.output).toBe(script);
+ expect(issue.stages.teleplay.status).toBe('ready');
+ // prose is NOT seeded — the script never round-trips through it.
+ expect(issue.stages.prose?.output).toBeFalsy();
+ });
+
it('still seeds stages.prose when contentType is absent (older clients)', async () => {
const { uni, ser } = await setupForCommit();
const result = await importerSvc.commitImport({