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: raise Create Importer source ceiling from 200K to 5M chars
Adam Eivy581cbf1a4142
diff --git a/client/src/pages/Importer.jsx b/client/src/pages/Importer.jsxindex a132f67abe..8a64cc8f61 100644--- a/client/src/pages/Importer.jsx+++ b/client/src/pages/Importer.jsx@@ -374,7 +374,7 @@ function IntakeForm({ intake, setIntake, sourceCharLimit, analyzing, onAnalyze,{sourceOver && (<p className="text-xs text-port-error mt-1 flex items-center gap-1"><AlertTriangle className="w-3 h-3" />- Source exceeds the v1 limit. Trim it or wait for chunked-extraction support.+ Source exceeds the {sourceCharLimit.toLocaleString()}-char ceiling. Trim it or wait for chunked-extraction support.</p>)}</div>diff --git a/client/src/services/apiImporter.js b/client/src/services/apiImporter.jsindex 58519114e8..85a69ddc34 100644--- a/client/src/services/apiImporter.js+++ b/client/src/services/apiImporter.js@@ -10,7 +10,7 @@ export const IMPORTER_CONTENT_TYPES = ['short-story', 'novel', 'screenplay', 'co// silently drifted from `server/lib/storyArc.js#ARC_ROLES`). Char limit// stays because the intake form's real-time counter needs a value before// the GET resolves.-export const IMPORTER_SOURCE_CHAR_LIMIT_FALLBACK = 200_000;+export const IMPORTER_SOURCE_CHAR_LIMIT_FALLBACK = 5_000_000;// Mirrors `CLASSIFY_SOURCE_HEAD_CHARS` in server/services/importer.js — the// classifier only reads the head; the client trims to match so we don't// ship up to 200K of body that gets discarded.diff --git a/server/routes/pipeline.js b/server/routes/pipeline.jsindex a857134f1f..84c035f697 100644--- a/server/routes/pipeline.js+++ b/server/routes/pipeline.js@@ -54,7 +54,6 @@ import {buildRenderSlot,} from '../services/pipeline/visualStages.js';import { extractCanonFromProse } from '../services/universeCanon.js';-import { IMPORTER_SOURCE_CHAR_LIMIT } from '../services/importer.js';import { getSeriesCanon } from '../services/pipeline/seriesCanon.js';import { startEpisodeVideoForIssue, ERR_NO_STORYBOARDS } from '../services/pipeline/episodeVideo.js';import { generateSeriesTitleLogo } from '../services/pipeline/seriesTitleLogo.js';@@ -476,11 +475,14 @@ const extractCanonFromScriptSchema = z.object({providerOverride: z.string().trim().max(80).optional(),});-// Reuses the importer's source-size ceiling — both feed the same-// `extractBible` machinery, so a single constant keeps the safe-corpus-// budget in sync. `STAGE_OUTPUT_MAX` (400KB) is large enough that long-// scripts can exceed most provider context windows; clamp before forwarding.-const EXTRACT_CANON_CORPUS_MAX = IMPORTER_SOURCE_CHAR_LIMIT;+// Per-issue truncation budget for canon extraction. Decoupled from the+// importer's source ceiling (which ingests a *whole book* — millions of+// chars): a pipeline issue's stage output is already hard-bounded at+// `STAGE_OUTPUT_MAX` (400KB), so this path operates at a fundamentally+// smaller scale. 200K clamps a long single-issue script before forwarding+// to the same `extractBible` machinery the importer uses, keeping the+// per-call corpus comfortably inside provider context windows.+const EXTRACT_CANON_CORPUS_MAX = 200_000;// Collapses the `extractCanonFromProse` result-shape trio used by both the// season-episodes continuity extract and the manual script-stage extract.diff --git a/server/services/importer.js b/server/services/importer.jsindex ba398410a3..e85f6b3fc6 100644--- a/server/services/importer.js+++ b/server/services/importer.js@@ -40,10 +40,16 @@ export const ERR_PARTIAL_COMMIT_ISSUES = 'IMPORTER_PARTIAL_COMMIT_ISSUES';const makeErr = (message, code) => Object.assign(new Error(message), { code });-// v1 hard cap on the source corpus. Big novels run ~500K chars; this keeps-// us under most providers' single-call context limit until the chunked-// fallback follow-up lands (PLAN.md / "Create Suite — Importer page").-export const IMPORTER_SOURCE_CHAR_LIMIT = 200_000;+// Sanity ceiling on the source corpus — matches the schema-layer abuse guard+// (`importerSourceField`, 5MB) so the importer doesn't impose an *artificial*+// product cap below it. A 5M-char source (~3,000 pages) is far beyond any real+// book — even War & Peace is ~3.2M. The real operational limit is dynamic: the+// active provider's context window, since the whole corpus still goes into one+// extraction call. Sources that fit the ceiling but overflow the chosen model's+// window will fail at the provider until the chunked-extraction follow-up lands+// (PLAN.md / "Create Suite — Importer page") — pick a large-context provider or+// trim the source in the meantime.+export const IMPORTER_SOURCE_CHAR_LIMIT = 5_000_000;// Per-content-type defaults when the user doesn't pass `targetIssueCount`.// `null` means "let the LLM decide" — short stories collapse to one; novels@@ -344,7 +350,7 @@ export async function classifyImportContent({ source, providerOverride } = {}) {}if (source.length > IMPORTER_SOURCE_CHAR_LIMIT) {throw makeErr(- `Source is ${source.length.toLocaleString()} chars — v1 limit is ${IMPORTER_SOURCE_CHAR_LIMIT.toLocaleString()}. Trim the source or wait for chunked-extraction support.`,+ `Source is ${source.length.toLocaleString()} chars — exceeds the ${IMPORTER_SOURCE_CHAR_LIMIT.toLocaleString()}-char ceiling. Trim the source or wait for chunked-extraction support.`,ERR_VALIDATION,);}@@ -403,7 +409,7 @@ export async function analyzeImport({}if (source.length > IMPORTER_SOURCE_CHAR_LIMIT) {throw makeErr(- `Source is ${source.length.toLocaleString()} chars — v1 limit is ${IMPORTER_SOURCE_CHAR_LIMIT.toLocaleString()}. Trim the source or wait for chunked-extraction support.`,+ `Source is ${source.length.toLocaleString()} chars — exceeds the ${IMPORTER_SOURCE_CHAR_LIMIT.toLocaleString()}-char ceiling. Trim the source or wait for chunked-extraction support.`,ERR_VALIDATION,);}