commit 5bf0e2440811003510d71637d5cc90bbea76a0b2
parent 4e081ceb3ed6c329a840d28bb5459cbeee3c8063
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 11 Nov 2026 06:34:05 -0500
reports: a sweep over a published archive cites that archive; its revisions, drafts, refresh and chain inherit it; projectsRoot defaults into REPORTS_DIR (demo epic D1 item 3)
resolveCorpus: with `remote:<origin>` the citation origin IS that origin
(citationOriginFor) -- settings.generation.citationOrigin overrides only when
set; a hub or a local dir keeps the old fallback. D0's sweeps over
jeralyzer.pages.dev cited archilyzer.pages.dev until the origin was set by hand.
The sweep's (and research run's) source is recorded in its iteration's
scope (`scope.source`, a handle) and read back down the lineage
(lineageSource): a revision, a media draft, a continuation of a research run
and a refresh read and cite the archive their sweep read instead of asking for
a local build that a fresh clone does not have. The chain's QR origin still
comes from the lineage's sweep.md links, and now falls back to the recorded
archive when none names one (chain-run.mjs sweepOrigin).
projectsRoot blank = <REPORTS_DIR>/articles when REPORTS_DIR is set (a
container sets it to its reports volume), else ~/reports/articles as before:
one rule, common/lib/projectsRoot.mjs, for the editor, the reports CLIs and
umtool's chain planner (the live units set no REPORTS_DIR: unchanged there).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat:
12 files changed, 181 insertions(+), 15 deletions(-)
diff --git a/common/bin/reports-delete.ts b/common/bin/reports-delete.ts
@@ -18,6 +18,7 @@
// refused, or a path could not be removed; 2 for usage, or no such article or
// iteration.
+import { projectsRootFrom } from "../lib/projectsRoot.mjs";
import os from "node:os";
import path from "node:path";
import type { GenerationSettings } from "../lib/generationSettings";
@@ -103,7 +104,7 @@ const expandHome = (p: string) => (p === "~" ? os.homedir() : p.startsWith("~/")
// settings.generation.projectsRoot, `~` expanded; blank = ~/reports/articles
// (controller/reportDraft.ts projectsRootOf, which a bin does not import).
export const projectsRootOf = (gen: Pick<GenerationSettings, "projectsRoot">): string =>
- gen.projectsRoot ? expandHome(gen.projectsRoot) : path.join(os.homedir(), "reports", "articles");
+ projectsRootFrom(gen.projectsRoot);
// The CLI row's options, from the flags and the settings.
export async function deleteRow(
diff --git a/common/bin/reports-import-local-runs.ts b/common/bin/reports-import-local-runs.ts
@@ -34,6 +34,7 @@
// Exit 0 when every run is importable (dry run) or imported (apply), or was
// imported before; 1 when any is refused or fails; 2 for a usage error.
+import { projectsRootFrom } from "../lib/projectsRoot.mjs";
import { cp, lstat, mkdir, readdir, readFile, rename, rm, stat } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
@@ -761,7 +762,7 @@ export function defaultGenerationWriter(env: NodeJS.ProcessEnv = process.env, fe
const expandHome = (p: string) => (p === "~" ? os.homedir() : p.startsWith("~/") ? path.join(os.homedir(), p.slice(2)) : p);
// settings.generation.projectsRoot, `~` expanded; blank = ~/reports/articles
// (controller/reportDraft.ts projectsRootOf, which a bin does not import).
-const projectsRootOf = (gen: GenerationSettings) => (gen.projectsRoot ? expandHome(gen.projectsRoot) : path.join(os.homedir(), "reports", "articles"));
+const projectsRootOf = (gen: GenerationSettings) => (projectsRootFrom(gen.projectsRoot));
// The CLI row's options, from the flags and the settings.
export async function importRow(flags: { apply?: boolean; runs?: string; only?: string; "move-projects"?: boolean; generation?: string }): Promise<number> {
diff --git a/common/controller/reportDraft.ts b/common/controller/reportDraft.ts
@@ -61,6 +61,8 @@
// MCP's, and common cannot import the mcp package.
import os from "node:os";
+import { projectsRootFrom } from "../lib/projectsRoot.mjs";
+import { originOfHandle } from "../lib/remoteArchives";
import path from "node:path";
import { runManagedFunction, type StreamActionResult } from "../jobs/streamCommand";
import type { JobProgress } from "../jobs/registry";
@@ -74,6 +76,7 @@ import { webTools } from "../lib/web/tools";
import {
copyIteration,
createIteration,
+ lineageSource,
readIteration,
readIterationFile,
reportSourceOf,
@@ -500,7 +503,7 @@ export function expandHome(p: string): string {
}
export function projectsRootOf(gen: GenerationSettings): string {
- return gen.projectsRoot ? expandHome(gen.projectsRoot) : path.join(os.homedir(), "reports", "articles");
+ return projectsRootFrom(gen.projectsRoot);
}
// The model a task runs on: the asked one, else the route's.
@@ -571,15 +574,28 @@ async function channelsOfReport(article: string, n: number, paths: Paths): Promi
return [...new Set(Object.values(cites).map((c) => c.channel).filter((c): c is string => !!c))];
}
-// The corpus and the origin the run cites on.
+// The origin a run over a named corpus cites on (demo epic D1 item 3): a
+// published archive's own origin — its moments are its pages — unless
+// settings.generation.citationOrigin is set, which overrides; a hub (whose
+// members each have their own) or a local dir, the citation origin or the
+// project's site, as before.
+export function citationOriginFor(source: string, gen: Pick<GenerationSettings, "citationOrigin">): string {
+ return gen.citationOrigin || originOfHandle(source) || PROJECT_URL;
+}
+
+// The corpus and the origin the run cites on. `inherited`: the corpus the
+// iteration's lineage read (lineageSource) — a revision, a media draft or a
+// refresh of a sweep over an archive reads that archive, not a local build.
export async function resolveCorpus(
body: Pick<ReportDraftBody, "source" | "build">,
channels: string[],
paths: Pick<Paths, "exportBuildsDir" | "sitesDir">,
gen: GenerationSettings,
+ inherited?: string | null,
): Promise<{ source: string; origin: string; build?: string }> {
const fallback = gen.citationOrigin || PROJECT_URL;
- if (body.source) return { source: body.source, origin: fallback };
+ const named = body.source ?? (body.build ? undefined : (inherited ?? undefined));
+ if (named) return { source: named, origin: citationOriginFor(named, gen) };
const b = await pickCorpusBuild(channels, { exportBuildsDir: paths.exportBuildsDir, ...(body.build ? { want: body.build } : {}) });
return { source: `local:${b.dir}`, origin: (await siteOriginOf(b.build, paths.sitesDir)) ?? fallback, build: b.build };
}
@@ -673,7 +689,9 @@ export async function enqueueReportDraft(raw: Record<string, unknown>, deps: Rep
})
: null;
const warnings: string[] = [];
- if (cont && !body.source) {
+ // A continuation of a research run over an archive reads that archive
+ // (the run inherits it: lineageSource), so no local build is asked for.
+ if (cont && !body.source && !(await lineageSource(body.article, cont.research.n, paths).catch(() => null))) {
// The sweep reads a composed build: one must hold the widened channels
// (a channel on no site is in none until the operator puts it on one
// and builds it), and an acquisition after the build is not in it.
@@ -715,7 +733,7 @@ export async function enqueueReportDraft(raw: Record<string, unknown>, deps: Rep
model,
parent: cont.research.n,
question: cont.question,
- scope: { channels: cont.channels, ...(cont.from ? { from: cont.from } : {}), ...(cont.to ? { to: cont.to } : {}), ...(body.ids ? { ids: body.ids } : {}) },
+ scope: { channels: cont.channels, ...(body.source ? { source: body.source } : {}), ...(cont.from ? { from: cont.from } : {}), ...(cont.to ? { to: cont.to } : {}), ...(body.ids ? { ids: body.ids } : {}) },
},
paths,
)
@@ -728,7 +746,7 @@ export async function enqueueReportDraft(raw: Record<string, unknown>, deps: Rep
kind: kindOf(body.task),
model,
...(body.task === "sweep" || body.task === "research"
- ? { question: body.question, scope: { ...(body.channels ? { channels: body.channels } : {}), ...(body.from ? { from: body.from } : {}), ...(body.to ? { to: body.to } : {}), ...(body.ids ? { ids: body.ids } : {}), ...(body.triage ? { triage: body.triage } : {}) } }
+ ? { question: body.question, scope: { ...(body.source ? { source: body.source } : {}), ...(body.channels ? { channels: body.channels } : {}), ...(body.from ? { from: body.from } : {}), ...(body.to ? { to: body.to } : {}), ...(body.ids ? { ids: body.ids } : {}), ...(body.triage ? { triage: body.triage } : {}) } }
: { parent: body.iteration!, feedback: body.feedback }),
},
paths,
@@ -794,7 +812,7 @@ async function runReportDraft(
let corpus: (CorpusToolsLike & { close(): Promise<void> }) | null = null;
let result: TaskResult | null = null;
try {
- const where = await resolveCorpus(body, channels, paths, gen);
+ const where = await resolveCorpus(body, channels, paths, gen, await lineageSource(body.article, n, paths).catch(() => null));
onLog(`corpus ${where.source}${where.build ? ` (build ${where.build})` : ""}; links on ${where.origin}`);
corpus = await deps.corpusTools(where.source);
const disk = paths.channelsDir;
diff --git a/common/controller/reportDraftSource.test.ts b/common/controller/reportDraftSource.test.ts
@@ -0,0 +1,41 @@
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { citationOriginFor, projectsRootOf, resolveCorpus } from "./reportDraft";
+import { defaultProjectsRoot } from "../lib/projectsRoot.mjs";
+import { defaults } from "../lib/settingsSchema";
+import { PROJECT_URL } from "../lib/project";
+
+// demo epic D1 item 3: a sweep over a published archive cites that archive.
+const gen = (over: Record<string, unknown> = {}) => ({ ...defaults().generation, ...over });
+const paths = { exportBuildsDir: "/nonexistent/builds", sitesDir: "/nonexistent/sites" };
+
+test("a remote source's citations are on its own origin; citationOrigin overrides only when set", () => {
+ assert.equal(citationOriginFor("remote:https://stub.test/", gen()), "https://stub.test");
+ assert.equal(citationOriginFor("remote:https://stub.test", gen({ citationOrigin: "https://mirror.test" })), "https://mirror.test");
+ // A hub's members each have their own origin; a local dir has none: as before.
+ assert.equal(citationOriginFor("hub:https://hub.test", gen()), PROJECT_URL);
+ assert.equal(citationOriginFor("local:/x", gen()), PROJECT_URL);
+});
+
+test("the corpus: the body's source, else the lineage's, before any local build", async () => {
+ assert.deepEqual(await resolveCorpus({ source: "remote:https://stub.test" }, ["alpha"], paths, gen()), { source: "remote:https://stub.test", origin: "https://stub.test" });
+ // A revision with no source of its own reads (and cites) what its sweep read.
+ assert.deepEqual(await resolveCorpus({}, ["alpha"], paths, gen(), "remote:https://stub.test"), { source: "remote:https://stub.test", origin: "https://stub.test" });
+ // A named build wins over the inherited source; with none on disk it is refused as before.
+ await assert.rejects(resolveCorpus({ build: "mine" }, ["alpha"], paths, gen(), "remote:https://stub.test"));
+ await assert.rejects(resolveCorpus({}, ["alpha"], paths, gen(), null));
+});
+
+test("projectsRoot blank: <REPORTS_DIR>/articles when set (a container's volume), else ~/reports/articles", () => {
+ assert.equal(defaultProjectsRoot({ REPORTS_DIR: "/data/reports" }), "/data/reports/articles");
+ assert.match(defaultProjectsRoot({}), /\/reports\/articles$/);
+ const saved = process.env.REPORTS_DIR;
+ process.env.REPORTS_DIR = "/data/reports";
+ try {
+ assert.equal(projectsRootOf(gen()), "/data/reports/articles");
+ assert.equal(projectsRootOf(gen({ projectsRoot: "/elsewhere" })), "/elsewhere");
+ } finally {
+ if (saved === undefined) delete process.env.REPORTS_DIR;
+ else process.env.REPORTS_DIR = saved;
+ }
+});
diff --git a/common/controller/reportRefresh.ts b/common/controller/reportRefresh.ts
@@ -46,6 +46,7 @@ import { readAllPosts } from "../lib/posts-server";
import {
createIteration,
currentIteration,
+ lineageSource,
listIterations,
readIteration,
readIterationFile,
@@ -68,6 +69,7 @@ import { jobOfPaths } from "./researchRuns";
import {
REPORT_DRAFT_JOB_KIND,
REPORT_DRAFT_RESULT_MARKER,
+ citationOriginFor,
llmConfigOf,
type ReportDraftBody,
type ReportDraftDeps,
@@ -399,13 +401,16 @@ async function runRefreshJob(
const hooks: RefreshHooks = {
...fetchHooksOf(deps),
openCorpus: async (channels, prefer) => {
- const b = body.source ? null : body.build ? (await listCorpusBuilds(paths.exportBuildsDir)).find((x) => x.build === body.build) ?? null : await refreshBuild(channels, prefer, paths);
- const source = body.source ?? (b ? `local:${b.dir}` : null);
+ // A refresh of a sweep over a published archive reads (and cites) that
+ // archive (demo epic D1): the source named, else the lineage's.
+ const named = body.source ?? (body.build ? null : await lineageSource(body.article, n, paths).catch(() => null));
+ const b = named ? null : body.build ? (await listCorpusBuilds(paths.exportBuildsDir)).find((x) => x.build === body.build) ?? null : await refreshBuild(channels, prefer, paths);
+ const source = named ?? (b ? `local:${b.dir}` : null);
if (!source) throw new Error(`no composed build holds ${channels.join(", ")} — publish build the site that carries them`);
const missing = b ? channels.filter((c) => !b.channels.includes(c)) : [];
if (missing.length) onLog(`the build ${b!.build} does not hold ${missing.join(", ")}: those are not searched`);
await holder.swap(await deps.corpusTools(source));
- const origin = b ? ((await siteOriginOf(b.build, paths.sitesDir)) ?? fallback) : fallback;
+ const origin = b ? ((await siteOriginOf(b.build, paths.sitesDir)) ?? fallback) : citationOriginFor(source, gen);
return { source, origin, ...(b ? { build: b.build } : {}) };
},
recordOf: async (channel, id) => {
diff --git a/common/lib/projectsRoot.mjs b/common/lib/projectsRoot.mjs
@@ -0,0 +1,37 @@
+// WHERE AN ARTICLE'S VIDEO PROJECTS LIVE when settings.generation.projectsRoot
+// is blank: `<REPORTS_DIR>/articles` when REPORTS_DIR is set — a container
+// sets it to its reports volume (/data/reports, Dockerfile), so a fresh
+// container's projects land on the volume and not in its writable layer —
+// else `~/reports/articles`, the host default since release 27 S6 (demo epic
+// D1 item 3; D0 found a container's projects outside the reports volume).
+//
+// Plain JS (with JSDoc) so umtool's plain-node chain planner
+// (umtool/lib/report/chain.mjs) reads the same rule as the editor's TS.
+
+import os from "node:os";
+import path from "node:path";
+
+/**
+ * @param {Record<string, string | undefined>} [env]
+ * @returns {string}
+ */
+export function defaultProjectsRoot(env = process.env) {
+ const reports = env.REPORTS_DIR?.trim();
+ if (reports) return path.join(path.resolve(/* turbopackIgnore: true */ reports), "articles");
+ return path.join(/* turbopackIgnore: true */ os.homedir(), "reports", "articles");
+}
+
+/** `~` and `~/` expanded against the home directory. */
+export function expandHomeDir(p) {
+ return p === "~" ? os.homedir() : p.startsWith("~/") ? path.join(os.homedir(), p.slice(2)) : p;
+}
+
+/**
+ * The projects root a settings value names: `~` expanded; blank = the default.
+ * @param {unknown} configured settings.generation.projectsRoot
+ * @param {Record<string, string | undefined>} [env]
+ */
+export function projectsRootFrom(configured, env = process.env) {
+ if (typeof configured !== "string" || !configured.trim()) return defaultProjectsRoot(env);
+ return expandHomeDir(configured.trim());
+}
diff --git a/common/lib/report/iterations.test.ts b/common/lib/report/iterations.test.ts
@@ -29,6 +29,7 @@ import {
iterationDir,
iterationUsd,
lineage,
+ lineageSource,
listIterations,
makeCurrent,
parseIteration,
@@ -282,3 +283,19 @@ test("an article may not be called `new` (umtool's /articles/new is a page)", as
/reserved/,
);
});
+
+// demo epic D1: a sweep over a published archive records it; its revisions read it.
+test("a sweep's source is kept in its scope and inherited down its lineage", async () => {
+ const paths = store();
+ await createIteration("arc", { kind: "sweep", model: "m", question: "q", scope: { channels: ["alpha"], source: "remote:https://stub.test" } }, paths, NOW);
+ await done(paths, "arc", 1, doc("arc"));
+ await createIteration("arc", { kind: "revise-report", model: "m", parent: 1, feedback: "tighter" }, paths, NOW);
+ assert.equal(await lineageSource("arc", 2, paths), "remote:https://stub.test");
+ assert.equal((await readIteration("arc", 1, paths))?.scope?.source, "remote:https://stub.test");
+ // A sweep of the editor's own build has none.
+ await createIteration("own", { kind: "sweep", model: "m", question: "q", scope: { channels: ["alpha"] } }, paths, NOW);
+ assert.equal(await lineageSource("own", 1, paths), null);
+ assert.equal(await lineageSource("nope", 1, paths), null);
+ // Not a handle: refused at the schema.
+ await assert.rejects(createIteration("bad", { kind: "sweep", model: "m", question: "q", scope: { channels: ["alpha"], source: "https://stub.test" } }, paths, NOW));
+});
diff --git a/common/lib/report/iterations.ts b/common/lib/report/iterations.ts
@@ -138,6 +138,10 @@ export const iterationScopeSchema = z.looseObject({
ids: z.array(z.string().min(1)).optional(),
// The triage run this sweep escalates (umtool R6): reports/.triage/<owner>/<k>/.
triage: z.looseObject({ owner: z.string().min(1), k: z.number().int().positive() }).optional(),
+ // The corpus the sweep read when it was not the editor's own build (demo epic
+ // D1): a handle, `remote:<archive origin>` or `hub:<url>`. Its revisions,
+ // media drafts and video chain read and cite the same one (lineageSource).
+ source: z.string().regex(/^(local|remote|hub):\S+/).optional(),
});
export type IterationScope = z.infer<typeof iterationScopeSchema>;
@@ -374,6 +378,19 @@ export async function lineage(id: string, n: number, paths: StorePaths = getPath
return out;
}
+// The corpus handle an iteration's lineage read (demo epic D1): the newest
+// `scope.source` from n back to its root, or null — the editor's own build.
+export async function lineageSource(id: string, n: number, paths: StorePaths = getPaths()): Promise<string | null> {
+ let at: number | null = n;
+ while (at !== null) {
+ const it: Iteration | null = await readIteration(id, at, paths);
+ if (!it) return null;
+ if (it.scope?.source) return it.scope.source;
+ at = it.parent;
+ }
+ return null;
+}
+
// A file of an iteration as text, or null when it has none.
export async function readIterationFile(
id: string,
diff --git a/common/package.json b/common/package.json
@@ -42,6 +42,7 @@
"./lib/atomicFile.mjs": "./lib/atomicFile.mjs",
"./lib/cueWiden.mjs": "./lib/cueWiden.mjs",
"./lib/detectPlatform.mjs": "./lib/detectPlatform.mjs",
+ "./lib/projectsRoot.mjs": "./lib/projectsRoot.mjs",
"./lib/evidenceClip.mjs": "./lib/evidenceClip.mjs",
"./lib/recordingClock.mjs": "./lib/recordingClock.mjs",
"./lib/recordingClock-read.mjs": "./lib/recordingClock-read.mjs",
diff --git a/umtool/lib/report/chain-run.mjs b/umtool/lib/report/chain-run.mjs
@@ -34,6 +34,7 @@ import { getPaths } from "yt-dlp-transcript-common/lib/paths";
import { articleDir, articleFile } from "yt-dlp-transcript-common/lib/report/registry";
import {
lineage,
+ lineageSource,
makeCurrent,
projectOf,
readIteration,
@@ -56,6 +57,7 @@ import { socialTexts } from "umtool-report-to-video/social";
import { PIPELINE_DIR } from "./driver.mjs";
import { dedupeMedia, seedFromParent } from "./iterations.mjs";
import { tmpPathFor } from "yt-dlp-transcript-common/lib/atomicFile.mjs";
+import { originOfHandle } from "yt-dlp-transcript-common/lib/remoteArchives";
const OPS = path.join(REPO_ROOT, "scripts", "archilyzer-ops.mjs");
const SCREENSHOT_MISSING = /no captured screenshot/;
@@ -437,13 +439,17 @@ async function writeJson(file, value) {
// The archive the sweep's moment links name — the QR codes' origin: the
// newest sweep.md in the iteration's lineage that names one.
+// When none does (a hand-made iteration, a sweep.md without moment links),
+// the published archive the lineage read (demo epic D1: `scope.source`,
+// remote:<origin>) — the editor cited it there.
async function sweepOrigin(ctx) {
const line = await lineage(ctx.article, ctx.n, ctx.paths).catch(() => [ctx.n]);
for (const n of [...line].reverse()) {
const origin = originFromSweep(await readIterationFile(ctx.article, n, "sweep.md", ctx.paths));
if (origin) return origin;
}
- return undefined;
+ const source = await lineageSource(ctx.article, ctx.n, ctx.paths).catch(() => null);
+ return originOfHandle(source) ?? undefined;
}
/**
diff --git a/umtool/lib/report/chain-run.test.mjs b/umtool/lib/report/chain-run.test.mjs
@@ -156,3 +156,22 @@ test("refusals: a queued iteration, an unknown step, no such iteration", () => {
assert.equal(none.code, 2);
assert.match(none.out, /has no iteration i9/);
});
+
+test("manifest: with no sweep.md naming an origin, the archive the sweep read (scope.source) is the QR origin (demo epic D1)", () => {
+ const dir = path.join(ARTICLES, "synth-remote", "iterations", "1");
+ put(path.join(dir, "iteration.json"), iteration(1, { article: "synth-remote", scope: { channels: ["synth-kitchen"], source: "remote:https://stub.test" } }));
+ put(path.join(dir, "report.json"), { ...basic, id: "synth-remote" });
+ const run = (name) =>
+ spawnSync(process.execPath, ["--import", "tsx", CHAIN_RUN, "step", "synth-remote", "1", name, "--projects-root", PROJECTS], {
+ cwd: REPO_ROOT,
+ env: ENV,
+ encoding: "utf8",
+ timeout: 120_000,
+ });
+ for (const name of ["current", "manifest"]) {
+ const r = run(name);
+ assert.equal(r.status, 0, `${name}: ${r.stdout}\n${r.stderr}`);
+ }
+ const m = json(path.join(PROJECTS, "synth-remote", "i1", "video.manifest.json"));
+ assert.equal(m.provenance.siteOrigin, "https://stub.test");
+});
diff --git a/umtool/lib/report/chain.mjs b/umtool/lib/report/chain.mjs
@@ -64,6 +64,7 @@ import { existsSync, readFileSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { UMTOOL_DIR } from "./driver.mjs";
+import { defaultProjectsRoot } from "yt-dlp-transcript-common/lib/projectsRoot.mjs";
// `draft`: the report-draft task an optional generation step runs.
// `modes`: the chains a step is in ("video" — make the video; "draft-all").
@@ -131,8 +132,10 @@ export const chainTask = (name) => `chain:${name}`;
// STARTER_RENDER): the windows are fetched this wide so the cut finds them.
export const CHAIN_WINDOW_PAD = 3;
-// Off the corpus disk (D1): `settings.generation.projectsRoot`, blank = this.
-export const DEFAULT_PROJECTS_ROOT = path.join(/* turbopackIgnore: true */ os.homedir(), "reports", "articles");
+// Off the corpus disk (D1): `settings.generation.projectsRoot`, blank = this —
+// `<REPORTS_DIR>/articles` when REPORTS_DIR is set (a container's reports
+// volume), else ~/reports/articles (common/lib/projectsRoot.mjs, the one rule).
+export const DEFAULT_PROJECTS_ROOT = defaultProjectsRoot();
// From driver.mjs's package root, which is found from the module (or, under
// the Next server, the cwd) — never this module's URL alone.