Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

refactor: remove redundant runtime infrastructure

kashorin68ceaeb47bb5
diff --git a/bin/build-cli.mjs b/bin/build-cli.mjs
deleted file mode 100644
index 012d10a4..00000000
--- a/bin/build-cli.mjs
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env node
-
-import { existsSync } from "node:fs";
-import { cp, mkdir, readdir, rm, writeFile } from "node:fs/promises";
-import { createRequire } from "node:module";
-import { dirname, resolve } from "node:path";
-import { spawnSync } from "node:child_process";
-import { fileURLToPath } from "node:url";
-
-const repository = resolve(dirname(fileURLToPath(import.meta.url)), "..");
-const staging = resolve(repository, "dist/cli/packages");
-const compiler = createRequire(import.meta.url).resolve("typescript/bin/tsc");
-const result = spawnSync(process.execPath, [compiler, "-p", resolve(repository, "tsconfig.cli.json"), "--pretty", "false"], {
- cwd: repository,
- stdio: "inherit",
-});
-if (result.status !== 0) process.exit(result.status ?? 1);
-
-for (const entry of await readdir(staging, { withFileTypes: true })) {
- if (!entry.isDirectory()) continue;
- const source = resolve(staging, entry.name, "src");
- if (!existsSync(source)) continue;
- const target = resolve(repository, "packages", entry.name, "dist");
- await rm(target, { recursive: true, force: true });
- await mkdir(target, { recursive: true });
- await cp(source, target, { recursive: true });
-}
-
-await writeFile(resolve(repository, "dist/cli-ready"), `${Date.now()}\n`, "utf8");
diff --git a/bin/compiled-loader.mjs b/bin/compiled-loader.mjs
deleted file mode 100644
index e350b477..00000000
--- a/bin/compiled-loader.mjs
+++ /dev/null
@@ -1,43 +0,0 @@
-import { existsSync } from "node:fs";
-import { createRequire, registerHooks } from "node:module";
-import { dirname, relative, resolve, sep } from "node:path";
-import { fileURLToPath, pathToFileURL } from "node:url";
-
-const repository = resolve(dirname(fileURLToPath(import.meta.url)), "..");
-const output = resolve(repository, "dist/cli");
-
-function sourceUrl(url) {
- if (!url.startsWith("file:")) return undefined;
- const built = fileURLToPath(url);
- const path = relative(output, built);
- if (path === ".." || path.startsWith(`..${sep}`)) return undefined;
- return pathToFileURL(resolve(repository, path.replace(/\.js$/u, ".ts"))).href;
-}
-
-function builtUrl(url) {
- if (!url.startsWith("file:") || !url.endsWith(".ts")) return undefined;
- const source = fileURLToPath(url);
- const path = relative(repository, source);
- if (path === ".." || path.startsWith(`..${sep}`)) return undefined;
- const match = /^packages\/([^/]+)\/src\/(.+)\.ts$/u.exec(path.split(sep).join("/"));
- if (match === null) return undefined;
- const built = resolve(repository, "packages", match[1], "dist", `${match[2]}.js`);
- return existsSync(built) ? pathToFileURL(built).href : undefined;
-}
-
-registerHooks({
- resolve(specifier, context, nextResolve) {
- let resolved;
- try {
- resolved = nextResolve(specifier, context);
- } catch (error) {
- const parent = context.parentURL === undefined ? undefined : sourceUrl(context.parentURL);
- if (parent === undefined || specifier.startsWith("node:") || specifier.startsWith(".") || specifier.startsWith("/")) {
- throw error;
- }
- resolved = { url: pathToFileURL(createRequire(parent).resolve(specifier)).href };
- }
- const built = builtUrl(resolved.url);
- return built === undefined ? resolved : { ...resolved, url: built };
- },
-});
diff --git a/bin/narratage.mjs b/bin/narratage.mjs
index 4aa841e2..cbf05c10 100755
--- a/bin/narratage.mjs
+++ b/bin/narratage.mjs
@@ -1,46 +1,7 @@
#!/usr/bin/env node
-import { existsSync, realpathSync, statSync } from "node:fs";
-import { readdir } from "node:fs/promises";
-import { spawnSync } from "node:child_process";
-import { dirname, resolve } from "node:path";
-import { fileURLToPath, pathToFileURL } from "node:url";
+import { register } from "tsx/esm/api";
-const root = realpathSync(resolve(dirname(fileURLToPath(import.meta.url)), ".."));
-const builtCli = resolve(root, "packages/video-cli/dist/cli.js");
-const ready = resolve(root, "dist/cli-ready");
-
-if (!existsSync(resolve(root, "node_modules/typescript/bin/tsc"))) {
- process.stderr.write(`Narratage dependencies are not installed in ${root}; run: pnpm install --frozen-lockfile\n`);
- process.exitCode = 1;
- process.exit();
-}
-
-async function sourceChanged(directory, builtAt) {
- for (const entry of await readdir(directory, { withFileTypes: true })) {
- const path = resolve(directory, entry.name);
- if (entry.isDirectory()) {
- if (entry.name === "dist" || entry.name === "node_modules" || entry.name === "test") continue;
- if (await sourceChanged(path, builtAt)) return true;
- } else if ((entry.name.endsWith(".ts") || entry.name === "package.json") && statSync(path).mtimeMs > builtAt) {
- return true;
- }
- }
- return false;
-}
-
-const builtAt = existsSync(ready) && existsSync(builtCli) ? statSync(ready).mtimeMs : 0;
-const configurationChanged = ["package.json", "pnpm-lock.yaml", "tsconfig.json", "tsconfig.cli.json", "bin/build-cli.mjs"]
- .some((path) => statSync(resolve(root, path)).mtimeMs > builtAt);
-if (builtAt === 0 || configurationChanged || await sourceChanged(resolve(root, "packages"), builtAt)) {
- process.stderr.write("Preparing Narratage CLI...\n");
- const result = spawnSync(process.execPath, [resolve(root, "bin/build-cli.mjs")], {
- cwd: root,
- stdio: "inherit",
- });
- if (result.status !== 0) process.exit(result.status ?? 1);
-}
-
-process.env.NARRATAGE_CLI_LAUNCHER ??= fileURLToPath(import.meta.url);
-await import("./compiled-loader.mjs");
-await import(pathToFileURL(builtCli).href);
+process.env.NARRATAGE_CLI_LAUNCHER ??= import.meta.filename;
+register();
+await import("../packages/video-cli/src/cli.ts");
diff --git a/package.json b/package.json
index 772210cb..d45e5f0e 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,6 @@
"test:browser-visual": "NARRATAGE_BROWSER_TESTS=1 node --import tsx --test packages/hyperframes/test/browser-visual.test.ts",
"test:image-opencv": "NARRATAGE_OPENCV_TESTS=1 NARRATAGE_OPENCV_PYTHON=services/image-opencv/.venv/bin/python node --import tsx --test packages/provider-image-opencv-local/test/provider.test.ts",
"smoke:kie": "node --import tsx packages/provider-kie/test/live-smoke.ts",
- "cli:build": "node bin/build-cli.mjs",
"narratage": "node bin/narratage.mjs",
"caption:playground": "pnpm --filter @narratage/caption-playground exec node --import tsx start.ts",
"svml:playground": "pnpm --filter @narratage/svml-playground exec node --import tsx start.ts",
diff --git a/packages/artifact/src/index.ts b/packages/artifact/src/index.ts
index e320bf8c..668646af 100644
--- a/packages/artifact/src/index.ts
+++ b/packages/artifact/src/index.ts
@@ -1,7 +1,6 @@
import type {
ModuleManifest,
TypeRef,
- ValueSchema,
} from "@narratage/protocol";
export const artifactModuleRef = { name: "@narratage/artifact", version: "1" } as const;
@@ -10,9 +9,6 @@ export const artifactTypes = {
blob: { module: artifactModuleRef, name: "BlobArtifact" },
} satisfies Record<string, TypeRef>;
-/** StoredValue.kind=blob already performs exact BlobRef structural validation in Protocol/Core. */
-export const blobArtifactValueSchema: ValueSchema = { kind: "blob" };
-
export const artifactManifest: ModuleManifest = {
format: "narratage.module@1",
name: artifactModuleRef.name,
diff --git a/packages/cli/package.json b/packages/cli/package.json
index ab242512..132a746b 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -17,8 +17,5 @@
"@narratage/runtime": "workspace:*",
"@narratage/runtime-host-node": "workspace:*",
"@narratage/source": "workspace:*"
- },
- "devDependencies": {
- "@narratage/runtime-local": "workspace:*"
}
}
diff --git a/packages/cli/src/distribution.ts b/packages/cli/src/distribution.ts
index dd9efd34..2afeb88d 100644
--- a/packages/cli/src/distribution.ts
+++ b/packages/cli/src/distribution.ts
@@ -37,6 +37,6 @@ export type CliDistribution = {
readonly selected: readonly string[];
readonly logical?: readonly import("@narratage/package-loader-node").LogicalPackageAddress[];
}>;
- /** Load the Runtime Host selected by the Profile's `runtime.use` package. */
+ /** Open the Runtime Profile with this application's Runtime implementation. */
openRuntimeHost(path: string, options: { readonly packageRoot: string }): Promise<NodeRuntimeHost>;
};
diff --git a/packages/cli/src/main.ts b/packages/cli/src/main.ts
index 152ff8ea..9582f579 100644
--- a/packages/cli/src/main.ts
+++ b/packages/cli/src/main.ts
@@ -8,10 +8,6 @@ import { plannedNeeds } from "@narratage/runtime";
import type { BuildCatalogDescriptor, CapacityReservation, OperationProgress } from "@narratage/runtime";
import type { BuildState, CapabilityRef, TypeRef } from "@narratage/protocol";
import { parseSourceHeader } from "@narratage/source";
-import {
- loadNodePackageSelection,
-} from "@narratage/package-loader-node";
-import type { LoadedPackage } from "@narratage/package-loader-node";
import {
acceptedArchivedOutputs,
@@ -58,7 +54,6 @@ type ParsedArgs = {
readonly runtime: string | undefined;
readonly follow: boolean;
readonly maxWaitMs: number | undefined;
- readonly packages: readonly string[];
readonly record: string | undefined;
readonly output: string | undefined;
readonly name: string | undefined;
@@ -119,7 +114,6 @@ function parseArgs(argv: readonly string[]): ParsedArgs {
let runtime: string | undefined;
let follow = false;
let maxWaitMs: number | undefined;
- const packages: string[] = [];
let record: string | undefined;
let output: string | undefined;
let name: string | undefined;
@@ -142,7 +136,7 @@ function parseArgs(argv: readonly string[]): ParsedArgs {
const item = rest[index]!;
if (item.startsWith("--")) {
const repeatable = [
- "--package", "--json", "--jsonl", "--watch", "--verbose", "--debug",
+ "--json", "--jsonl", "--watch", "--verbose", "--debug",
"--no-color", "--follow", "--apply", "--no-programs", "--asset-root",
].includes(item);
if (!repeatable && seenOptions.has(item)) throw new Error(`${item} cannot be repeated`);
@@ -201,13 +195,6 @@ function parseArgs(argv: readonly string[]): ParsedArgs {
index += 1;
continue;
}
- if (item === "--package") {
- const value = rest[index + 1];
- if (value === undefined || value.startsWith("--")) throw new Error("--package requires an installed package name");
- packages.push(value);
- index += 1;
- continue;
- }
if (item === "--runtime") {
const value = rest[index + 1];
if (value === undefined || value.startsWith("--")) throw new Error("--runtime requires a Runtime Profile");
@@ -322,7 +309,6 @@ function parseArgs(argv: readonly string[]): ParsedArgs {
runtime,
follow,
maxWaitMs,
- packages,
record,
output,
name,
@@ -504,13 +490,9 @@ function capabilityName(capability: CapabilityRef): string {
async function preflightPlan(
host: NodeRuntimeHost,
state: BuildState,
- implementationPackages?: readonly LoadedPackage[],
) {
const capabilities = demandedCapabilities(state);
- const result = await host.doctor({
- capabilities,
- ...(implementationPackages === undefined ? {} : { implementationPackages }),
- });
+ const result = await host.doctor({ capabilities });
return {
ok: !result.diagnostics.some((item) => item.severity === "error"),
dataRoot: result.dataRoot,
@@ -534,13 +516,8 @@ function assertPreflight(
].join("\n"));
}
-async function loadRuntime(
- host: NodeRuntimeHost,
- implementationPackages?: readonly LoadedPackage[],
-): Promise<CliRuntime> {
- return await host.createRuntime({
- ...(implementationPackages === undefined ? {} : { implementationPackages }),
- });
+async function loadRuntime(host: NodeRuntimeHost): Promise<CliRuntime> {
+ return await host.createRuntime();
}
async function loadRuntimeArchive(
@@ -813,12 +790,7 @@ export async function runCli(
};
if (args.command === "_worker") {
if (args.file === undefined || args.readyFile === undefined) throw new Error("internal Worker launch is incomplete");
- const implementationPackages = args.packages.length === 0
- ? undefined
- : await loadNodePackageSelection(args.packages, await packageRootForProject());
- await (await runtimeHost(args.file, await packageRootForProject())).runWorker(args.readyFile, {
- ...(implementationPackages === undefined ? {} : { implementationPackages }),
- });
+ await (await runtimeHost(args.file, await packageRootForProject())).runWorker(args.readyFile);
return;
}
if (args.command === "runtime" && args.action === "use") {
@@ -911,7 +883,6 @@ export async function runCli(
?? (source === undefined ? process.cwd() : dirname(resolve(source)));
const packageRoot = await packageRootForProject(workspaceRoot);
return await (await runtimeHost(profile, packageRoot)).controller({
- workspaceRoot,
packageRoot,
});
};
@@ -938,7 +909,7 @@ export async function runCli(
return;
}
if (args.command === "doctor") {
- if (args.packageRoot !== undefined || args.packages.length > 0 || args.apply) {
+ if (args.packageRoot !== undefined || args.apply) {
throw new Error("doctor reads all deployment selection from the Runtime Profile itself");
}
const profileInput = args.runtime ?? args.file;
@@ -961,7 +932,7 @@ export async function runCli(
if (args.file !== undefined && args.runtime !== undefined) {
throw new Error("programs reads all deployment selection from the Runtime Profile itself; provide that Profile only once");
}
- if (args.packageRoot !== undefined || args.packages.length > 0 || args.apply) {
+ if (args.packageRoot !== undefined || args.apply) {
throw new Error("programs reads all deployment selection from the Runtime Profile itself");
}
if (args.action !== "up" && args.action !== "down" && args.action !== "status") {
@@ -1109,7 +1080,7 @@ export async function runCli(
return;
}
if (args.command === "gc") {
- if (args.packageRoot !== undefined || args.packages.length > 0) {
+ if (args.packageRoot !== undefined) {
throw new Error("gc reads all deployment selection from the Runtime Profile itself");
}
const profileInput = args.runtime ?? args.file;
@@ -1577,7 +1548,6 @@ export async function runCli(
}
return;
}
- if (args.packages.length > 0) throw new Error("--package is reserved for the internal Worker launch");
const runtimePaths = args.runtime === undefined
? undefined
: await (await runtimeHost(args.runtime)).resolvePaths();
@@ -1694,21 +1664,19 @@ export async function runCli(
id: `bld_${randomUUID()}`,
definition: result.definition,
...(loadedPackageSet === undefined ? {} : {
- implementationPackages: loadedPackageSet.map((item) => item.specifier),
+ componentPackages: loadedPackageSet
+ .filter((item) => (item.contribution.components?.length ?? 0) > 0)
+ .map((item) => item.specifier),
}),
catalog,
attachments: result.compilation.attachments,
} as const;
const controller = await (await runtimeHost(args.runtime)).controller({
- workspaceRoot: effectiveWorkspaceRoot,
- ...(loadedPackageSet === undefined ? {} : {
- implementationPackages: loadedPackageSet.map((item) => item.specifier),
- }),
packageRoot: sourcePackageRoot,
});
let programs: Awaited<ReturnType<typeof startDeclaredPrograms>> | undefined;
let worker = await controller.worker.status();
- const preflight = await preflightPlan(await runtimeHost(args.runtime), result.state, loadedPackageSet);
+ const preflight = await preflightPlan(await runtimeHost(args.runtime), result.state);
// A managed program being down is repairable after Runtime validation;
// every other deployment error fails before we construct execution or
// start anything. With --no-programs, readiness errors remain fatal.
@@ -1722,7 +1690,7 @@ export async function runCli(
demandedCapabilities(result.state),
reportProgramProgress,
);
- runtime = await loadRuntime(await runtimeHost(args.runtime), loadedPackageSet);
+ runtime = await loadRuntime(await runtimeHost(args.runtime));
let built = await runtime.build(request);
try {
worker = await controller.worker.up({
@@ -1841,7 +1809,7 @@ export async function runCli(
const result = loaded.compiler.planCompilation(loaded);
const preflight = args.runtime === undefined
? undefined
- : await preflightPlan(await runtimeHost(args.runtime), result.state, loadedPackageSet);
+ : await preflightPlan(await runtimeHost(args.runtime), result.state);
writeCliOutput(io, args, {
kind: "plan",
machine: {
diff --git a/packages/cli/src/runtime-selection.ts b/packages/cli/src/runtime-selection.ts
index 0471af66..6c1c244b 100644
--- a/packages/cli/src/runtime-selection.ts
+++ b/packages/cli/src/runtime-selection.ts
@@ -84,7 +84,7 @@ export async function findRuntimeProfile(start: string): Promise<RuntimeProfileS
}
}
-/** Remove only the local pointer. Runtime state, locks, Programs and Builds are untouched. */
+/** Remove only the local pointer. Runtime state, Programs and Builds are untouched. */
export async function clearRuntimeProfile(start: string): Promise<RuntimeProfileSelection | undefined> {
const selected = await readSelectionFile(start);
if (selected === undefined) return undefined;
diff --git a/packages/cli/test/control-commands.test.ts b/packages/cli/test/control-commands.test.ts
index 07c7c17d..72c944b7 100644
--- a/packages/cli/test/control-commands.test.ts
+++ b/packages/cli/test/control-commands.test.ts
@@ -64,7 +64,7 @@ test("status --watch reattaches to one durable Build until it becomes terminal",
};
const dispatch = (phase: "queued" | "terminal") => ({
build: "build-watch",
- implementationPackages: [],
+ componentPackages: [],
createdAt: 1,
availableAt: 1,
phase,
diff --git a/packages/compiler-markup-node/package.json b/packages/compiler-markup-node/package.json
index 150610a7..5653d3cf 100644
--- a/packages/compiler-markup-node/package.json
+++ b/packages/compiler-markup-node/package.json
@@ -17,7 +17,6 @@
"@narratage/validation": "workspace:*"
},
"devDependencies": {
- "@narratage/protocol": "workspace:*",
"@narratage/workspace-fs-node": "workspace:*"
}
}
diff --git a/packages/compiler-node/test/compiler.test.ts b/packages/compiler-node/test/compiler.test.ts
index ae5900c8..a92b8b91 100644
--- a/packages/compiler-node/test/compiler.test.ts
+++ b/packages/compiler-node/test/compiler.test.ts
@@ -468,7 +468,7 @@ test("source assets become graph values and a Host transfer bundle without closu
assert.notEqual(second.attachments[0]?.artifact.digest, attachment?.artifact.digest);
});
-test("an installed package Surface can contribute locked bytes without an author file or network", async () => {
+test("an installed package Surface can contribute embedded bytes without an author file or network", async () => {
const root = await mkdtemp(join(tmpdir(), "narratage-embedded-assets-"));
const file = join(root, "main.svml");
await writeFile(file, `<?svml using="@narratage/markup@1"?>
@@ -516,7 +516,7 @@ test("Run compilation retains embedded Author attachments for later Runtime stag
assert.deepEqual(await readAttachment(compiled.attachments[0]), new Uint8Array([8, 6, 7, 5, 3, 0, 9]));
});
-test("filesystem Workspace contains symlinks and locks source text plus asset identity once", async () => {
+test("filesystem Workspace captures source text and asset identity once", async () => {
const parent = await mkdtemp(join(tmpdir(), "narratage-source-host-"));
const root = join(parent, "project");
await mkdir(root);
@@ -542,11 +542,11 @@ test("filesystem Workspace contains symlinks and locks source text plus asset id
assert.equal(firstIncluded.text, "included-first");
const firstAsset = await workspace.resolveAsset(entry, { from: "./asset.bin", mediaType: "application/octet-stream" });
await writeFile(assetPath, new Uint8Array([4, 5, 6, 7]));
- const lockedAsset = await workspace.resolveAsset(entry, { from: "./asset.bin", mediaType: "application/octet-stream" });
- assert.deepEqual(lockedAsset, firstAsset, "one Host locks an asset edge to the first bytes read");
+ const capturedAsset = await workspace.resolveAsset(entry, { from: "./asset.bin", mediaType: "application/octet-stream" });
+ assert.deepEqual(capturedAsset, firstAsset, "one Workspace keeps an asset edge bound to the first bytes read");
const detached = await workspace.attachments();
assert.deepEqual(await readAttachment(detached[0]), new Uint8Array([4, 5, 6, 7]),
- "attachment bytes are opened lazily; Runtime rejects them if they no longer match the locked identity");
+ "attachment bytes are opened lazily; Runtime rejects them if they no longer match the captured identity");
assert.equal((await workspace.attachments())[0]?.artifact.digest, firstAsset.artifact.digest);
await assert.rejects(
async () => await workspace.resolveSource(entry, {
diff --git a/packages/component-kit/src/index.ts b/packages/component-kit/src/index.ts
index 6a6c9c69..bf4f059f 100644
--- a/packages/component-kit/src/index.ts
+++ b/packages/component-kit/src/index.ts
@@ -45,7 +45,7 @@ export type ProducerHandler = (
context: ProducerHandlerContext,
) => Awaitable<ProducerHandlerResult>;
-/** Minimal structural port implemented by Node ProducerRegistry and any future compute Host. */
+/** Minimal structural port implemented by a Producer registry. */
export interface ProducerRegistrar {
registerProducer(
producer: ProducerRef,
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 70f54560..5a442e5c 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -15,17 +15,15 @@ export {
verifyBuildRequest,
verifyCompiledGraph,
} from "./graph.js";
-export { compileBuild, plannedNeeds, validatePlan } from "./plan.js";
+export { compileBuild, plannedNeeds } from "./plan.js";
export type { PlannedNeed } from "./plan.js";
export { sliceExecution } from "./slice.js";
export {
admitBuildResult,
- buildDefinition,
defineBuild,
materializeBuild,
reduce,
start,
} from "./reducer.js";
-export { BuildMachine, restoreBuildMachine } from "./machine.js";
-export { validateStoredValue } from "./schema.js";
+export { BuildMachine } from "./machine.js";
export type { TypedRecordDraft } from "./link.js";
diff --git a/packages/core/src/machine.ts b/packages/core/src/machine.ts
index 5bdf42c2..4974dd9b 100644
--- a/packages/core/src/machine.ts
+++ b/packages/core/src/machine.ts
@@ -36,7 +36,7 @@ export class BuildMachine {
return this.#state.records.find((item) => item.id === id);
}
- /** Materialized compatibility/read view. It is never the durable Store representation. */
+ /** Materialized read view. It is never the durable Store representation. */
view(): BuildState {
return this.#state;
}
@@ -58,10 +58,3 @@ export class BuildMachine {
this.#proposal = undefined;
}
}
-
-export function restoreBuildMachine(
- definition: BuildDefinition,
- facts: readonly BuildFact[],
-): BuildMachine {
- return new BuildMachine(definition, facts);
-}
diff --git a/packages/core/src/plan.ts b/packages/core/src/plan.ts
index cf0e544f..5ebc398c 100644
--- a/packages/core/src/plan.ts
+++ b/packages/core/src/plan.ts
@@ -303,16 +303,6 @@ function validatePlanStructure(
assertAllStepsReachGoal(plan, records);
}
-export function validatePlan(
- program: LinkedProgram,
- graph: CompiledGraph,
- request: BuildRequest,
- plan: BuildPlan,
-): void {
- verifyBuildRequest(program, graph, request);
- validatePlanStructure(program, graph, plan);
-}
-
/** Materialize selected zero-input values from their sole source of truth: the Run Graph. */
export function selectedProvidedRecords(
program: LinkedProgram,
diff --git a/packages/core/src/reducer.ts b/packages/core/src/reducer.ts
index f1830a7a..0162b78e 100644
--- a/packages/core/src/reducer.ts
+++ b/packages/core/src/reducer.ts
@@ -282,14 +282,6 @@ export function defineBuild(
};
}
-/** Extract the immutable definition from a materialized compatibility view. */
-export function buildDefinition(state: BuildState): BuildDefinition {
- return {
- format: "narratage.build-definition@1",
- ...definitionContent(state),
- };
-}
-
function initialBuildView(definition: BuildDefinition): BuildState {
return {
format: "narratage.build@1",
diff --git a/packages/core/src/reference.ts b/packages/core/src/reference.ts
index 8f78b5cc..4d1b42cf 100644
--- a/packages/core/src/reference.ts
+++ b/packages/core/src/reference.ts
@@ -23,7 +23,3 @@ export function sameModule(left: ModuleRef, right: ModuleRef): boolean {
export function sameType(left: TypeRef, right: TypeRef): boolean {
return sameModule(left.module, right.module) && left.name === right.name;
}
-
-export function sameCapability(left: CapabilityRef, right: CapabilityRef): boolean {
- return sameModule(left.module, right.module) && left.name === right.name;
-}
diff --git a/packages/core/src/schema.ts b/packages/core/src/schema.ts
deleted file mode 100644
index 9795ea5f..00000000
--- a/packages/core/src/schema.ts
+++ /dev/null
@@ -1,137 +0,0 @@
-import type { CanonicalValue, StoredValue, ValueSchema } from "@narratage/protocol";
-
-import { canonicalStringify, isDigest } from "./canonical.js";
-import { CoreError, invariant } from "./error.js";
-
-function fail(path: string, message: string): never {
- throw new CoreError("VALUE_SCHEMA_MISMATCH", `${path} ${message}`, path);
-}
-
-/**
- * Prove that an object-shaped union branch cannot match by looking only at its
- * literal fields. This is a semantic no-op: a branch skipped here would fail
- * the normal object validation at the same field. It matters for large
- * discriminated IRs, where trying every named union variant would otherwise
- * construct thousands of exceptions before finding a literal mismatch.
- */
-function objectLiteralMismatch(value: CanonicalValue, schema: ValueSchema): boolean {
- if (schema.kind !== "object" || value === null || Array.isArray(value) || typeof value !== "object") {
- return false;
- }
- const object = value as Readonly<Record<string, CanonicalValue>>;
- for (const [name, field] of Object.entries(schema.fields)) {
- if (field.schema.kind !== "literal") continue;
- if (!Object.hasOwn(object, name)) return field.optional !== true;
- if (canonicalStringify(object[name] as CanonicalValue) !== canonicalStringify(field.schema.value)) {
- return true;
- }
- }
- return false;
-}
-
-function validateInline(value: CanonicalValue, schema: ValueSchema, path: string): void {
- switch (schema.kind) {
- case "null":
- if (value !== null) fail(path, "must be null");
- return;
- case "boolean":
- if (typeof value !== "boolean") fail(path, "must be a boolean");
- return;
- case "number":
- if (typeof value !== "number" || !Number.isFinite(value)) fail(path, "must be a number");
- if (schema.integer === true && !Number.isInteger(value)) fail(path, "must be an integer");
- if (schema.minimum !== undefined && value < schema.minimum) {
- fail(path, `must be >= ${schema.minimum}`);
- }
- if (schema.maximum !== undefined && value > schema.maximum) {
- fail(path, `must be <= ${schema.maximum}`);
- }
- return;
- case "string":
- if (typeof value !== "string") fail(path, "must be a string");
- if (schema.enum !== undefined && !schema.enum.includes(value)) {
- fail(path, `must be one of ${schema.enum.join(", ")}`);
- }
- if (schema.minLength !== undefined && [...value].length < schema.minLength) {
- fail(path, `must contain at least ${schema.minLength} characters`);
- }
- if (schema.maxLength !== undefined && [...value].length > schema.maxLength) {
- fail(path, `must contain at most ${schema.maxLength} characters`);
- }
- return;
- case "literal":
- if (canonicalStringify(value) !== canonicalStringify(schema.value)) {
- fail(path, "does not match the literal value");
- }
- return;
- case "array":
- if (!Array.isArray(value)) fail(path, "must be an array");
- if (schema.minItems !== undefined && value.length < schema.minItems) {
- fail(path, `must contain at least ${schema.minItems} items`);
- }
- if (schema.maxItems !== undefined && value.length > schema.maxItems) {
- fail(path, `must contain at most ${schema.maxItems} items`);
- }
- value.forEach((item, index) => validateInline(item, schema.items, `${path}[${index}]`));
- return;
- case "object": {
- if (value === null || Array.isArray(value) || typeof value !== "object") {
- fail(path, "must be an object");
- }
- const object = value as Readonly<Record<string, CanonicalValue>>;
- for (const [name, field] of Object.entries(schema.fields)) {
- if (!Object.hasOwn(object, name)) {
- if (field.optional !== true) fail(`${path}.${name}`, "is required");
- continue;
- }
- validateInline(object[name] as CanonicalValue, field.schema, `${path}.${name}`);
- }
- if (schema.allowUnknown !== true) {
- for (const name of Object.keys(object)) {
- if (!Object.hasOwn(schema.fields, name)) fail(`${path}.${name}`, "is not declared");
- }
- }
- return;
- }
- case "oneOf": {
- let matches = 0;
- for (const variant of schema.variants) {
- if (objectLiteralMismatch(value, variant)) continue;
- try {
- validateInline(value, variant, path);
- matches += 1;
- } catch (error) {
- if (!(error instanceof CoreError) || error.code !== "VALUE_SCHEMA_MISMATCH") throw error;
- }
- }
- if (matches !== 1) fail(path, `must match exactly one variant, matched ${matches}`);
- return;
- }
- case "blob":
- fail(path, "must be a blob reference");
- }
-}
-
-export function validateStoredValue(value: StoredValue, schema: ValueSchema, path = "$value"): void {
- if (schema.kind === "blob") {
- invariant(value.kind === "blob", "VALUE_SCHEMA_MISMATCH", `${path} must be a blob`, path);
- invariant(isDigest(value.digest), "INVALID_BLOB", `${path}.digest is invalid`, path);
- invariant(Number.isSafeInteger(value.size) && value.size >= 0, "INVALID_BLOB", `${path}.size is invalid`);
- invariant(value.mediaType.length > 0, "INVALID_BLOB", `${path}.mediaType is empty`, path);
- if (schema.maxBytes !== undefined) {
- invariant(value.size <= schema.maxBytes, "VALUE_SCHEMA_MISMATCH", `${path} exceeds maxBytes`, path);
- }
- if (schema.mediaTypes !== undefined) {
- invariant(
- schema.mediaTypes.includes(value.mediaType),
- "VALUE_SCHEMA_MISMATCH",
- `${path}.mediaType is not accepted`,
- path,
- );
- }
- return;
- }
-
- invariant(value.kind === "inline", "VALUE_SCHEMA_MISMATCH", `${path} must be inline`, path);
- validateInline(value.value, schema, path);
-}
diff --git a/packages/core/test/core.test.ts b/packages/core/test/core.test.ts
index 17c93b3c..da003591 100644
--- a/packages/core/test/core.test.ts
+++ b/packages/core/test/core.test.ts
@@ -2,10 +2,8 @@ import assert from "node:assert/strict";
import test from "node:test";
import {
BuildMachine,
- CoreError,
- buildDefinition,
+ defineBuild,
reduce,
- validateStoredValue,
} from "@narratage/core";
import type {
CommandResult,
@@ -13,7 +11,6 @@ import type {
BuildState,
FulfillNeedCommand,
InvokeProducerCommand,
- ValueSchema,
} from "@narratage/protocol";
import { createGreetingBuild } from "./greeting-fixture.js";
@@ -91,37 +88,9 @@ test("Core executes a finite plan through an external Need and completion", () =
});
});
-test("oneOf literal discrimination preserves exact-one semantics", () => {
- const tagged = (tag: string): ValueSchema => ({
- kind: "object",
- fields: {
- kind: { schema: { kind: "literal", value: tag } },
- payload: { schema: { kind: "string" } },
- },
- });
- const generic: ValueSchema = {
- kind: "object",
- fields: {
- kind: { schema: { kind: "string" } },
- payload: { schema: { kind: "string" } },
- },
- };
-
- assert.doesNotThrow(() => validateStoredValue(
- { kind: "inline", value: { kind: "alpha", payload: "hello" } },
- { kind: "oneOf", variants: [tagged("alpha"), tagged("beta")] },
- ));
- assert.throws(
- () => validateStoredValue(
- { kind: "inline", value: { kind: "alpha", payload: "hello" } },
- { kind: "oneOf", variants: [tagged("alpha"), generic] },
- ),
- (error: unknown) => error instanceof CoreError && error.code === "VALUE_SCHEMA_MISMATCH",
- );
-});
-
test("Build Definition plus admitted Facts restores the same next Command", () => {
- const definition = buildDefinition(createGreetingBuild());
+ const initial = createGreetingBuild();
+ const definition = defineBuild(initial.program, initial.graph, initial.request);
const machine = new BuildMachine(definition);
const facts: BuildFact[] = [];
const prompt = machine.commands()[0];
diff --git a/packages/credential-store-env/package.json b/packages/credential-store-env/package.json
index d9594fde..f31062dd 100644
--- a/packages/credential-store-env/package.json
+++ b/packages/credential-store-env/package.json
@@ -11,7 +11,6 @@
"activation": "./src/activation.ts"
},
"dependencies": {
- "@narratage/protocol": "workspace:*",
"@narratage/runtime": "workspace:*",
"@narratage/runtime-kit": "workspace:*"
}
diff --git a/packages/credential-store-keychain/package.json b/packages/credential-store-keychain/package.json
index 24a3c78f..9ec9f6d5 100644
--- a/packages/credential-store-keychain/package.json
+++ b/packages/credential-store-keychain/package.json
@@ -11,7 +11,6 @@
"activation": "./src/activation.ts"
},
"dependencies": {
- "@narratage/protocol": "workspace:*",
"@narratage/runtime": "workspace:*",
"@narratage/runtime-kit": "workspace:*"
}
diff --git a/packages/driver-node/test/scheduler.test.ts b/packages/driver-node/test/scheduler.test.ts
index 66cf58f0..aa4204a6 100644
--- a/packages/driver-node/test/scheduler.test.ts
+++ b/packages/driver-node/test/scheduler.test.ts
@@ -9,9 +9,8 @@ import {
import type { AsyncEndpoint } from "@narratage/endpoint-kit";
import {
LocalBuildScheduler,
- MemoryOperationStore,
} from "@narratage/runtime";
-import type { OperationStore } from "@narratage/runtime";
+import type { OperationSnapshot, OperationStore, OperationUpdate } from "@narratage/runtime";
import {
createResolvedClosure,
link,
@@ -23,6 +22,42 @@ import {
import { capabilities, createGreetingBuild, manifest, producers as greetingProducers, types } from "../../core/test/greeting-fixture.js";
+function memoryOperations(): OperationStore {
+ const values = new Map<string, OperationSnapshot>();
+ return {
+ async create(operation) {
+ values.set(operation.id, structuredClone(operation));
+ return structuredClone(operation);
+ },
+ async read(id) {
+ const value = values.get(id);
+ return value === undefined ? undefined : structuredClone(value);
+ },
+ async list(query) {
+ return [...values.values()].filter((item) =>
+ (query.build === undefined || item.build === query.build)
+ && (query.command === undefined || item.command === query.command)
+ && (query.endpoint === undefined || item.endpoint === query.endpoint));
+ },
+ async update(id, update: OperationUpdate) {
+ const current = values.get(id);
+ if (current === undefined) throw new Error(`Operation ${id} does not exist`);
+ if (["completed", "failed", "cancelled"].includes(current.status)) return structuredClone(current);
+ const next = {
+ id: current.id,
+ build: current.build,
+ command: current.command,
+ endpoint: current.endpoint,
+ pool: current.pool,
+ lane: current.lane,
+ ...structuredClone(update),
+ } as OperationSnapshot;
+ values.set(id, next);
+ return structuredClone(next);
+ },
+ };
+}
+
function createParallelGreetingBuild(generationCount = 2) {
const generations = ["a", "b", "c"].slice(0, generationCount);
const closure = createResolvedClosure([manifest]);
@@ -240,7 +275,7 @@ test("independent paid commands inside one Build may fill the same resource with
});
test("an asynchronous Endpoint starts once and is polled until complete", async () => {
- const operations = new MemoryOperationStore();
+ const operations = memoryOperations();
let starts = 0;
let polls = 0;
let operationId: string | undefined;
@@ -285,7 +320,7 @@ test("an asynchronous Endpoint starts once and is polled until complete", async
});
test("wakeAt prevents early polling and Runtime cancellation becomes a terminal Core failure", async () => {
- const operations = new MemoryOperationStore();
+ const operations = memoryOperations();
let polls = 0;
let cancels = 0;
const wakeAt = Date.now() + 60_000;
diff --git a/packages/elaborator/src/author.ts b/packages/elaborator/src/author.ts
index 44edc318..b7b202b7 100644
--- a/packages/elaborator/src/author.ts
+++ b/packages/elaborator/src/author.ts
@@ -52,7 +52,7 @@ export type AuthorOutputBinding = {
readonly type: TypeRef;
};
-/** Resolve a locked Graph Fragment without executing package code. */
+/** Resolve a selected Graph Fragment without executing package code. */
export type GraphFragmentResolver = (id: string) => GraphFragment | undefined;
export class AuthorGraphError extends Error {
@@ -145,7 +145,7 @@ function outputKey(component: string, output: string): string {
return `${component}\u0000${output}`;
}
-/** Phase one: lock every component and predeclare every public output before resolving any input. */
+/** Phase one: collect every component and predeclare every public output before resolving any input. */
function collectAuthorGraph(
program: LinkedProgram,
declarations: readonly AuthorComponent[],
diff --git a/packages/host/package.json b/packages/host/package.json
index 543cb408..a46660f6 100644
--- a/packages/host/package.json
+++ b/packages/host/package.json
@@ -6,8 +6,5 @@
"type": "module",
"exports": {
".": "./src/index.ts"
- },
- "dependencies": {
- "@narratage/protocol": "workspace:*"
}
}
diff --git a/packages/package-loader-node/package.json b/packages/package-loader-node/package.json
index 7bd28ba4..17c5d8e1 100644
--- a/packages/package-loader-node/package.json
+++ b/packages/package-loader-node/package.json
@@ -11,9 +11,5 @@
"@narratage/component-kit": "workspace:*",
"@narratage/host": "workspace:*",
"@narratage/protocol": "workspace:*"
- },
- "devDependencies": {
- "@narratage/runtime-kit": "workspace:*",
- "@narratage/validation": "workspace:*"
}
}
diff --git a/packages/protocol/src/index.ts b/packages/protocol/src/index.ts
index 37f31205..05d98525 100644
--- a/packages/protocol/src/index.ts
+++ b/packages/protocol/src/index.ts
@@ -1,6 +1,5 @@
export * from "./canonical.js";
export * from "./error.js";
-export { parseModuleManifest, parseModuleManifestText } from "./manifest.js";
export { modulePackageAbi } from "./module.js";
export { blobRefObjectSchema } from "./value.js";
export type * from "./build.js";
diff --git a/packages/protocol/src/manifest.ts b/packages/protocol/src/manifest.ts
deleted file mode 100644
index cfd786d1..00000000
--- a/packages/protocol/src/manifest.ts
+++ /dev/null
@@ -1,133 +0,0 @@
-import { canonicalize } from "./canonical.js";
-import type {
- CapabilityDeclaration,
- ModuleDependency,
- ModuleManifest,
- NeedPortDeclaration,
- PortDeclaration,
- ProducerDeclaration,
- TypeDeclaration,
-} from "./module.js";
-import type { CapabilityRef, ModuleRef, TypeRef } from "./identity.js";
-
-function object(value: unknown, path: string): Record<string, unknown> {
- if (value === null || Array.isArray(value) || typeof value !== "object") {
- throw new Error(`${path} must be an object`);
- }
- return value as Record<string, unknown>;
-}
-
-function array(value: unknown, path: string): unknown[] {
- if (!Array.isArray(value)) throw new Error(`${path} must be an array`);
- return value;
-}
-
-function string(value: unknown, path: string): string {
- if (typeof value !== "string" || value.length === 0) throw new Error(`${path} must be a string`);
- return value;
-}
-
-function moduleRef(value: unknown, path: string): ModuleRef {
- const parsed = object(value, path);
- return {
- name: string(parsed.name, `${path}.name`),
- version: string(parsed.version, `${path}.version`),
- };
-}
-
-function typeRef(value: unknown, path: string): TypeRef {
- const parsed = object(value, path);
- return {
- module: moduleRef(parsed.module, `${path}.module`),
- name: string(parsed.name, `${path}.name`),
- };
-}
-
-function capabilityRef(value: unknown, path: string): CapabilityRef {
- const parsed = object(value, path);
- return {
- module: moduleRef(parsed.module, `${path}.module`),
- name: string(parsed.name, `${path}.name`),
- };
-}
-
-function dependency(value: unknown, path: string): ModuleDependency {
- const parsed = object(value, path);
- return {
- module: moduleRef(parsed.module, `${path}.module`),
- };
-}
-
-function typeDeclaration(value: unknown, path: string): TypeDeclaration {
- const parsed = object(value, path);
- return {
- name: string(parsed.name, `${path}.name`),
- };
-}
-
-function capabilityDeclaration(value: unknown, path: string): CapabilityDeclaration {
- const parsed = object(value, path);
- return {
- name: string(parsed.name, `${path}.name`),
- returns: typeRef(parsed.returns, `${path}.returns`),
- };
-}
-
-function port(value: unknown, path: string): PortDeclaration {
- const parsed = object(value, path);
- return {
- name: string(parsed.name, `${path}.name`),
- type: typeRef(parsed.type, `${path}.type`),
- };
-}
-
-function needPort(value: unknown, path: string): NeedPortDeclaration {
- const parsed = object(value, path);
- return {
- name: string(parsed.name, `${path}.name`),
- capability: capabilityRef(parsed.capability, `${path}.capability`),
- returns: typeRef(parsed.returns, `${path}.returns`),
- };
-}
-
-function producer(value: unknown, path: string): ProducerDeclaration {
- const parsed = object(value, path);
- return {
- name: string(parsed.name, `${path}.name`),
- inputs: array(parsed.inputs, `${path}.inputs`).map((item, index) =>
- port(item, `${path}.inputs[${index}]`),
- ),
- outputs: array(parsed.outputs, `${path}.outputs`).map((item, index) =>
- port(item, `${path}.outputs[${index}]`),
- ),
- needs: array(parsed.needs, `${path}.needs`).map((item, index) =>
- needPort(item, `${path}.needs[${index}]`),
- ),
- };
-}
-
-export function parseModuleManifest(value: unknown): ModuleManifest {
- const parsed = object(canonicalize(value), "$manifest");
- if (parsed.format !== "narratage.module@1") throw new Error("$manifest.format must be narratage.module@1");
- return {
- format: "narratage.module@1",
- name: string(parsed.name, "$manifest.name"),
- version: string(parsed.version, "$manifest.version"),
- dependencies: array(parsed.dependencies, "$manifest.dependencies").map((item, index) =>
- dependency(item, `$manifest.dependencies[${index}]`),
- ),
- types: array(parsed.types, "$manifest.types").map((item, index) =>
- typeDeclaration(item, `$manifest.types[${index}]`),
- ),
- capabilities: array(parsed.capabilities, "$manifest.capabilities").map((item, index) =>
- capabilityDeclaration(item, `$manifest.capabilities[${index}]`),
- ),
- producers: array(parsed.producers, "$manifest.producers").map((item, index) =>
- producer(item, `$manifest.producers[${index}]`),
- ),
- };
-}
-
-export function parseModuleManifestText(text: string): ModuleManifest {
- return parseModuleManifest(JSON.parse(text) as unknown);
-}
diff --git a/packages/provider-kie/test/live-smoke.ts b/packages/provider-kie/test/live-smoke.ts
index 37ab3c00..37051380 100644
--- a/packages/provider-kie/test/live-smoke.ts
+++ b/packages/provider-kie/test/live-smoke.ts
@@ -6,8 +6,8 @@ import { FileArtifactStore } from "@narratage/artifact-store-fs";
import { EnvironmentCredentialStore } from "@narratage/credential-store-env";
import { registerTypeValidatorFacets } from "@narratage/component-kit";
import {
- buildDefinition,
createResolvedClosure,
+ defineBuild,
link,
sealBuildRequest,
sealCompiledGraph,
@@ -418,7 +418,7 @@ async function main(): Promise<void> {
try {
const state = await createBuild(item);
const build = await runtime.build(
- { id: `bld_${randomUUID()}`, definition: buildDefinition(state) },
+ { id: `bld_${randomUUID()}`, definition: defineBuild(state.program, state.graph, state.request) },
{ follow: true, pollIntervalMs: 1_000, maxWaitMs: 20 * 60_000 },
);
if (build.status !== "complete") throw new Error(failureMessage(item, build));
diff --git a/packages/provider-media-aws-lambda/package.json b/packages/provider-media-aws-lambda/package.json
index 2d2abefe..1315012e 100644
--- a/packages/provider-media-aws-lambda/package.json
+++ b/packages/provider-media-aws-lambda/package.json
@@ -14,12 +14,10 @@
"@narratage/artifact": "workspace:*",
"@narratage/endpoint-kit": "workspace:*",
"@narratage/media": "workspace:*",
- "@narratage/media-execution": "workspace:*",
"@narratage/media-pipeline": "workspace:*",
"@narratage/protocol": "workspace:*",
"@narratage/runtime-kit": "workspace:*",
"@narratage/speech": "workspace:*",
- "@narratage/transport": "workspace:*",
"@narratage/transport-aws-lambda": "workspace:*"
},
"devDependencies": {
diff --git a/packages/provider-media-aws-lambda/src/provider.ts b/packages/provider-media-aws-lambda/src/provider.ts
index dd537737..a37fa753 100644
--- a/packages/provider-media-aws-lambda/src/provider.ts
+++ b/packages/provider-media-aws-lambda/src/provider.ts
@@ -7,7 +7,7 @@ import { speechTypes } from "@narratage/speech";
import { defineEndpointPackage } from "@narratage/endpoint-kit";
import type { EndpointFulfillment, EndpointInvocationContext } from "@narratage/endpoint-kit";
import { AwsLambdaJsonInvoker } from "@narratage/transport-aws-lambda";
-import type { JsonInvoker } from "@narratage/transport";
+import type { JsonInvoker } from "@narratage/transport-aws-lambda";
import {
MEDIA_LAMBDA_REQUEST,
diff --git a/packages/provider-media-aws-lambda/test/provider.test.ts b/packages/provider-media-aws-lambda/test/provider.test.ts
index 048a71f8..d801a6c7 100644
--- a/packages/provider-media-aws-lambda/test/provider.test.ts
+++ b/packages/provider-media-aws-lambda/test/provider.test.ts
@@ -6,7 +6,7 @@ import { MemoryArtifactStore } from "@narratage/driver-node";
import { canonicalize } from "@narratage/protocol";
import type { CanonicalValue } from "@narratage/protocol";
import type { ImmediateEndpointHandler } from "@narratage/endpoint-kit";
-import type { JsonInvoker } from "@narratage/transport";
+import type { JsonInvoker } from "@narratage/transport-aws-lambda";
import {
createAwsLambdaMediaProvider,
diff --git a/packages/run-markup/test/run.test.ts b/packages/run-markup/test/run.test.ts
index 2874c23d..5c305fc6 100644
--- a/packages/run-markup/test/run.test.ts
+++ b/packages/run-markup/test/run.test.ts
@@ -136,7 +136,7 @@ test("Run Markup compilation consumes decode output without repeating package di
assert.equal(compiled.document.targets[0]?.output, "left");
});
-test("Run Fragments enter the Host only through the locked Run facet ABI", () => {
+test("Run Fragments enter the Host only through the selected Run facet ABI", () => {
const fragment = previewFragment();
const facet = createRunFragmentHostFacet({ name: "@example/run-preview", fragments: { shared: fragment } });
const registry = new RunFragmentRegistry();
diff --git a/packages/runtime-host-node/README.md b/packages/runtime-host-node/README.md
index ca404c28..5cc6428a 100644
--- a/packages/runtime-host-node/README.md
+++ b/packages/runtime-host-node/README.md
@@ -1,10 +1,9 @@
# `@narratage/runtime-host-node`
-Node.js Host for Runtime packages selected by a Runtime Profile, plus environment helpers for adapter
-implementations.
+Node.js Runtime port shared by the generic CLI and an application's chosen Runtime implementation,
+plus environment helpers for Endpoint adapters.
-The package keeps Node-specific hosting out of the host-neutral `@narratage/runtime-kit` ABI. It
-defines the Node Runtime Host port loaded by the CLI and also provides:
+The package keeps Node-specific process control out of the host-neutral Runtime contracts. It provides:
- project-root resolution for configured relative executable paths;
- executable availability diagnostics for absolute, relative and `PATH` commands;
@@ -13,6 +12,6 @@ defines the Node Runtime Host port loaded by the CLI and also provides:
These functions produce `RuntimeDoctorDiagnostic` values only. They do not construct Endpoints,
read secret values, execute commands or choose fallback Providers.
-`loadNodeRuntimeHost()` reads only the Runtime Profile header, resolves the installed package selected
-by `runtime.use`, and opens its Host facet. The selected package then owns Runtime assembly, lifecycle
-and storage. The generic CLI never imports `@narratage/runtime-local` or assumes a local Worker.
+The generic CLI depends only on this port. The official video application selects
+`@narratage/runtime-local` directly; Runtime Profiles vary stores and Endpoints rather than replacing
+the Runtime itself.
diff --git a/packages/runtime-host-node/package.json b/packages/runtime-host-node/package.json
index c0875883..2ec4b5b3 100644
--- a/packages/runtime-host-node/package.json
+++ b/packages/runtime-host-node/package.json
@@ -8,8 +8,6 @@
".": "./src/index.ts"
},
"dependencies": {
- "@narratage/host": "workspace:*",
- "@narratage/package-loader-node": "workspace:*",
"@narratage/protocol": "workspace:*",
"@narratage/runtime": "workspace:*",
"@narratage/runtime-kit": "workspace:*",
diff --git a/packages/runtime-host-node/src/index.ts b/packages/runtime-host-node/src/index.ts
index f5e7db90..7b962a4d 100644
--- a/packages/runtime-host-node/src/index.ts
+++ b/packages/runtime-host-node/src/index.ts
@@ -1,14 +1,8 @@
-import { access, readFile } from "node:fs/promises";
+import { access } from "node:fs/promises";
import { constants } from "node:fs";
-import { delimiter, dirname, isAbsolute, resolve } from "node:path";
-
-import type { HostFacet } from "@narratage/host";
-import {
- loadNodePackageSelection,
-} from "@narratage/package-loader-node";
-import type { LoadedPackage } from "@narratage/package-loader-node";
+import { delimiter, isAbsolute, resolve } from "node:path";
import type { ArtifactAttachment } from "@narratage/workspace";
-import type { BuildDefinition, BuildState, CanonicalValue, CapabilityRef, Digest } from "@narratage/protocol";
+import type { BuildDefinition, BuildState, CapabilityRef, Digest } from "@narratage/protocol";
import type {
BuildCatalogDescriptor,
BuildCatalogEntry,
@@ -21,8 +15,6 @@ import type {
} from "@narratage/runtime";
import type { RuntimeDoctorDiagnostic } from "@narratage/runtime-kit";
-export const nodeRuntimeHostAdapterAbi = "narratage.node-runtime-host-adapter@1";
-
export type RuntimeHostBuildSubmission = {
readonly id: string;
readonly state: BuildState;
@@ -93,7 +85,7 @@ export type RuntimeHostExecution = RuntimeHostMaintenance & RuntimeHostCredentia
build(request: {
readonly id: string;
readonly definition: BuildDefinition;
- readonly implementationPackages?: readonly string[];
+ readonly componentPackages?: readonly string[];
readonly catalog?: BuildCatalogDescriptor;
readonly attachments?: readonly ArtifactAttachment[];
}, options?: {
@@ -168,95 +160,19 @@ export type NodeRuntimeHost = {
readonly runtimeDataRoot?: string;
}>;
controller(options?: {
- readonly workspaceRoot?: string;
- readonly implementationPackages?: readonly string[];
readonly packageRoot?: string;
}): Promise<RuntimeController>;
- createRuntime(options?: { readonly implementationPackages?: readonly LoadedPackage[] }): Promise<RuntimeHostExecution>;
+ createRuntime(): Promise<RuntimeHostExecution>;
openArchive(options?: { readonly readOnly?: boolean }): Promise<RuntimeHostArchive>;
openArtifacts(options?: { readonly readOnly?: boolean }): Promise<RuntimeHostArtifactAccess>;
openMaintenance(options?: { readonly readOnly?: boolean }): Promise<RuntimeHostMaintenance>;
openCredentials(endpoint: string): Promise<RuntimeHostCredentialControl>;
doctor(options?: {
readonly capabilities?: readonly CapabilityRef[];
- readonly implementationPackages?: readonly LoadedPackage[];
}): Promise<RuntimeHostDoctorResult>;
- runWorker(readyFile: string, options?: {
- readonly implementationPackages?: readonly LoadedPackage[];
- }): Promise<void>;
-};
-
-export type NodeRuntimeHostAdapterContext = {
- readonly profile: string;
- readonly profileRoot: string;
- readonly packageRoot: string;
- readonly config: CanonicalValue;
- readonly workerLaunch: RuntimeWorkerLaunch;
+ runWorker(readyFile: string): Promise<void>;
};
-export type NodeRuntimeHostAdapterFacet = HostFacet & {
- readonly abi: typeof nodeRuntimeHostAdapterAbi;
- readonly offers: readonly [string];
- readonly implementation: {
- open(context: NodeRuntimeHostAdapterContext): NodeRuntimeHost | Promise<NodeRuntimeHost>;
- };
-};
-
-function nonEmpty(value: unknown, subject: string): string {
- if (typeof value !== "string" || value.trim().length === 0) throw new Error(`${subject} must be a non-empty string`);
- return value;
-}
-
-export function createNodeRuntimeHostAdapterFacet(options: {
- readonly use: string;
- readonly open: NodeRuntimeHostAdapterFacet["implementation"]["open"];
-}): NodeRuntimeHostAdapterFacet {
- return {
- abi: nodeRuntimeHostAdapterAbi,
- offers: [nonEmpty(options.use, "Runtime Host Adapter use")],
- implementation: { open: options.open },
- };
-}
-
-export async function loadNodeRuntimeHost(
- path: string,
- options: { readonly packageRoot: string; readonly workerLaunch: RuntimeWorkerLaunch },
-): Promise<NodeRuntimeHost> {
- const profile = resolve(path);
- const profileRoot = dirname(profile);
- const value = JSON.parse(await readFile(profile, "utf8")) as Record<string, unknown>;
- if (value.format !== "narratage.runtime-profile@1") {
- throw new Error("Runtime Profile format must be narratage.runtime-profile@1");
- }
- const runtime = value.runtime;
- if (runtime === null || typeof runtime !== "object" || Array.isArray(runtime)) {
- throw new Error("Runtime Profile runtime must be an object");
- }
- const record = runtime as Record<string, unknown>;
- const use = nonEmpty(record.use, "Runtime Profile runtime.use");
- const config = (record.config ?? {}) as CanonicalValue;
- const loaded = await loadNodePackageSelection({
- selected: [],
- logical: [{ abi: nodeRuntimeHostAdapterAbi, name: use }],
- }, options.packageRoot);
- const matches = loaded.flatMap((item) => item.contribution.hostFacets ?? [])
- .filter((facet): facet is NodeRuntimeHostAdapterFacet => facet.abi === nodeRuntimeHostAdapterAbi
- && facet.offers?.includes(use) === true);
- if (matches.length !== 1) throw new Error(`Runtime Host Adapter ${use} must have exactly one implementation`);
- const implementation = matches[0]!.implementation;
- if (implementation === null || typeof implementation !== "object"
- || typeof (implementation as { readonly open?: unknown }).open !== "function") {
- throw new Error(`Runtime Host Adapter ${use} does not implement open()`);
- }
- return await implementation.open({
- profile,
- profileRoot,
- packageRoot: resolve(options.packageRoot),
- config,
- workerLaunch: options.workerLaunch,
- });
-}
-
function pathLike(value: string): boolean {
return isAbsolute(value) || value.includes("/") || value.includes("\\");
}
diff --git a/packages/runtime-kit/src/index.ts b/packages/runtime-kit/src/index.ts
index 6f943d0c..525e8633 100644
--- a/packages/runtime-kit/src/index.ts
+++ b/packages/runtime-kit/src/index.ts
@@ -1,6 +1,5 @@
import type { EndpointPackage } from "@narratage/endpoint-kit";
import type { HostFacet } from "@narratage/host";
-import { canonicalize } from "@narratage/protocol";
import type { CanonicalValue } from "@narratage/protocol";
import { credentialRef } from "@narratage/runtime";
import type { ArtifactStore, CredentialRef, CredentialStore } from "@narratage/runtime";
@@ -283,7 +282,3 @@ export function runtimeConfigCredentialRef(
assert(store !== undefined && key !== undefined, `${subject} requires store and key`);
return credentialRef(store, key);
}
-
-export function canonicalRuntimeConfig(value: unknown): CanonicalValue {
- return canonicalize(value);
-}
diff --git a/packages/runtime-local/package.json b/packages/runtime-local/package.json
index 8d27f94a..13ec0112 100644
--- a/packages/runtime-local/package.json
+++ b/packages/runtime-local/package.json
@@ -10,14 +10,10 @@
"./programs": "./src/programs.ts",
"./worker-process": "./src/worker-process.ts"
},
- "narratage": {
- "activation": "./src/activation.ts"
- },
"dependencies": {
"@narratage/component-kit": "workspace:*",
"@narratage/driver-node": "workspace:*",
"@narratage/endpoint-kit": "workspace:*",
- "@narratage/workspace": "workspace:*",
"@narratage/package-loader-node": "workspace:*",
"@narratage/protocol": "workspace:*",
"@narratage/runtime": "workspace:*",
diff --git a/packages/runtime-local/src/activation.ts b/packages/runtime-local/src/activation.ts
deleted file mode 100644
index f25409b2..00000000
--- a/packages/runtime-local/src/activation.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { localRuntimeHostAdapter } from "./host.js";
-
-export const narratagePackage = {
- format: "narratage.node-package@1" as const,
- hostFacets: [localRuntimeHostAdapter],
-};
-
-export default narratagePackage;
diff --git a/packages/runtime-local/src/config.ts b/packages/runtime-local/src/config.ts
index 79a3814a..207ffb36 100644
--- a/packages/runtime-local/src/config.ts
+++ b/packages/runtime-local/src/config.ts
@@ -3,7 +3,7 @@ import { dirname, resolve } from "node:path";
import type { ComponentPackage } from "@narratage/component-kit";
import { collectNodePackageComponents, loadNodePackageSelection } from "@narratage/package-loader-node";
-import type { LoadedPackage, NodePackageSelectionRequest } from "@narratage/package-loader-node";
+import type { NodePackageSelectionRequest } from "@narratage/package-loader-node";
import { canonicalize } from "@narratage/protocol";
import type { CanonicalValue, CapabilityRef } from "@narratage/protocol";
import {
@@ -50,7 +50,6 @@ export type RuntimeConfigEntry = {
export type RuntimeConfigDocument = {
readonly format: "narratage.runtime-profile@1";
- readonly runtimeUse: "@narratage/runtime-local";
readonly dataRoot: string;
readonly artifacts: RuntimeConfigEntry;
readonly credentials: readonly RuntimeConfigEntry[];
@@ -62,7 +61,6 @@ export type LoadRuntimeConfigOptions = {
readonly registry?: RuntimeAdapterRegistry;
readonly components?: readonly ComponentPackage[];
readonly packageRoot?: string;
- readonly implementationPackages?: readonly LoadedPackage[];
readonly readOnly?: boolean;
};
@@ -148,7 +146,6 @@ export function parseRuntimeConfig(value: unknown): RuntimeConfigDocument {
if (new Set(ids).size !== ids.length) throw new Error("$runtime repeats a Runtime instance id");
return {
format: "narratage.runtime-profile@1",
- runtimeUse: "@narratage/runtime-local",
dataRoot: requiredString(config.dataRoot, "$runtime.runtime.config.dataRoot"),
artifacts,
credentials,
@@ -447,11 +444,11 @@ export async function createRuntimeFromConfig(
dispatchStore: state.dispatch,
artifactStore: artifacts.value,
credentialStore: credentials.store,
- components: [
- ...collectNodePackageComponents((options.implementationPackages ?? []).map((item) => item.contribution)),
- ...(options.components ?? []),
- ],
- implementationPackages: (options.implementationPackages ?? []).map((item) => item.specifier),
+ components: options.components ?? [],
+ loadComponentPackages: async (specifiers) => {
+ const loaded = await loadNodePackageSelection(specifiers, packageRoot);
+ return collectNodePackageComponents(loaded.map((item) => item.contribution));
+ },
endpoints,
scheduling: { maxConcurrency: document.concurrency },
close: async () => {
diff --git a/packages/runtime-local/src/control.ts b/packages/runtime-local/src/control.ts
index 35b69952..a239fb30 100644
--- a/packages/runtime-local/src/control.ts
+++ b/packages/runtime-local/src/control.ts
@@ -79,9 +79,6 @@ export function createLocalRuntimeArchiveControl(
operations: operationHistory,
};
},
- async operation(id) {
- return await options.operationStore.read(id);
- },
async builds() {
return await buildCatalog?.list() ?? [];
},
diff --git a/packages/runtime-local/src/host.ts b/packages/runtime-local/src/host.ts
index 0bf726e5..85aa666c 100644
--- a/packages/runtime-local/src/host.ts
+++ b/packages/runtime-local/src/host.ts
@@ -1,11 +1,9 @@
-import {
- createNodeRuntimeHostAdapterFacet,
-} from "@narratage/runtime-host-node";
import type {
NodeRuntimeHost,
- NodeRuntimeHostAdapterContext,
RuntimeController,
+ RuntimeWorkerLaunch,
} from "@narratage/runtime-host-node";
+import { resolve } from "node:path";
import {
createRuntimeArchiveFromConfig,
@@ -29,56 +27,35 @@ import {
stopRuntimeProcess,
} from "./worker-process.js";
-async function createLocalRuntimeHost(context: NodeRuntimeHostAdapterContext): Promise<NodeRuntimeHost> {
- const profile = context.profile;
- const basePackageRoot = context.packageRoot;
- const controller = async (options: {
- readonly workspaceRoot?: string;
- readonly implementationPackages?: readonly string[];
+export async function openLocalRuntimeHost(
+ path: string,
+ hostOptions: { readonly packageRoot: string; readonly workerLaunch: RuntimeWorkerLaunch },
+): Promise<NodeRuntimeHost> {
+ const profile = resolve(path);
+ const basePackageRoot = resolve(hostOptions.packageRoot);
+ const controller = async (controllerOptions: {
readonly packageRoot?: string;
} = {}): Promise<RuntimeController> => {
- const packageRoot = options.packageRoot ?? basePackageRoot;
+ const packageRoot = controllerOptions.packageRoot ?? basePackageRoot;
const selection = await resolveRuntimeConfigPaths(profile, { packageRoot });
- const implementationPackages = async (): Promise<readonly string[]> => {
- const values = new Set(options.implementationPackages ?? []);
- const archive = await createRuntimeArchiveFromConfig(profile, { packageRoot, readOnly: true });
- try {
- const queue = await archive.queue();
- for (const dispatch of queue.dispatches) {
- if (dispatch.phase === "terminal") continue;
- for (const item of dispatch.implementationPackages) values.add(item);
- }
- } finally {
- await archive.close();
- }
- return [...values].sort();
- };
return {
profile,
dataRoot: selection.dataRoot,
worker: {
up: async (workerOptions) => {
- const packages = await implementationPackages();
return await ensureRuntimeProcess(
profile,
selection.dataRoot,
{
- ...context.workerLaunch,
+ ...hostOptions.workerLaunch,
workerArgs: [
- ...(options.workspaceRoot === undefined ? [] : ["--workspace", options.workspaceRoot]),
- ...packages.flatMap((item) => ["--package", item]),
"--package-root", packageRoot,
],
},
workerOptions?.maxWaitMs ?? 10_000,
- packages,
);
},
- status: async () => await runtimeProcessStatus(
- profile,
- selection.dataRoot,
- await implementationPackages(),
- ),
+ status: async () => await runtimeProcessStatus(profile, selection.dataRoot),
logs: async () => await runtimeProcessLogs(selection.dataRoot),
down: async (workerOptions) => await stopRuntimeProcess(
profile,
@@ -103,12 +80,7 @@ async function createLocalRuntimeHost(context: NodeRuntimeHostAdapterContext): P
};
},
controller,
- createRuntime: async (options) => await createRuntimeFromConfig(profile, {
- packageRoot: basePackageRoot,
- ...(options?.implementationPackages === undefined
- ? {}
- : { implementationPackages: options.implementationPackages }),
- }),
+ createRuntime: async () => await createRuntimeFromConfig(profile, { packageRoot: basePackageRoot }),
openArchive: async (options) => await createRuntimeArchiveFromConfig(profile, {
packageRoot: basePackageRoot,
...(options?.readOnly === undefined ? {} : { readOnly: options.readOnly }),
@@ -129,17 +101,9 @@ async function createLocalRuntimeHost(context: NodeRuntimeHostAdapterContext): P
doctor: async (options) => await doctorRuntimeConfig(profile, {
packageRoot: basePackageRoot,
...(options?.capabilities === undefined ? {} : { capabilities: options.capabilities }),
- ...(options?.implementationPackages === undefined
- ? {}
- : { implementationPackages: options.implementationPackages }),
}),
- runWorker: async (readyFile, options) => {
- const runtime = await createRuntimeFromConfig(profile, {
- packageRoot: basePackageRoot,
- ...(options?.implementationPackages === undefined
- ? {}
- : { implementationPackages: options.implementationPackages }),
- });
+ runWorker: async (readyFile) => {
+ const runtime = await createRuntimeFromConfig(profile, { packageRoot: basePackageRoot });
const abort = new AbortController();
const stop = (): void => abort.abort();
process.once("SIGTERM", stop);
@@ -158,8 +122,3 @@ async function createLocalRuntimeHost(context: NodeRuntimeHostAdapterContext): P
},
};
}
-
-export const localRuntimeHostAdapter = createNodeRuntimeHostAdapterFacet({
- use: "@narratage/runtime-local",
- open: createLocalRuntimeHost,
-});
diff --git a/packages/runtime-local/src/index.ts b/packages/runtime-local/src/index.ts
index a725a260..cefc79f4 100644
--- a/packages/runtime-local/src/index.ts
+++ b/packages/runtime-local/src/index.ts
@@ -7,6 +7,7 @@ export { createLocalCredentialControl } from "./credentials.js";
export {
createLocalRuntime,
} from "./runtime.js";
+export { openLocalRuntimeHost } from "./host.js";
export {
createRuntimeFromConfig,
createRuntimeArchiveFromConfig,
diff --git a/packages/runtime-local/src/programs.ts b/packages/runtime-local/src/programs.ts
index 350f485b..aa7871c2 100644
--- a/packages/runtime-local/src/programs.ts
+++ b/packages/runtime-local/src/programs.ts
@@ -66,50 +66,6 @@ function nodeError(error: unknown, code: string): boolean {
return error instanceof Error && "code" in error && error.code === code;
}
-async function withProgramLifecycleLock<T>(
- root: string,
- id: string,
- timeoutMs: number,
- runLocked: () => Promise<T>,
-): Promise<T> {
- const path = join(directory(root), `${id}.lifecycle.lock`);
- await mkdir(directory(root), { recursive: true });
- const deadline = Date.now() + timeoutMs;
- while (true) {
- let lock;
- try {
- lock = await open(path, "wx");
- } catch (error) {
- if (!nodeError(error, "EEXIST")) throw error;
- let owner: { readonly pid?: unknown } | undefined;
- try {
- owner = JSON.parse(await readFile(path, "utf8")) as { readonly pid?: unknown };
- } catch (readError) {
- if (nodeError(readError, "ENOENT")) continue;
- if (Date.now() >= deadline) throw new Error(`External program ${id} lifecycle lock is unreadable: ${path}`);
- await sleep(25);
- continue;
- }
- if (Number.isSafeInteger(owner.pid) && !alive(owner.pid as number)) {
- await rm(path, { force: true });
- continue;
- }
- if (Date.now() >= deadline) {
- throw new Error(`External program ${id} lifecycle is busy${Number.isSafeInteger(owner.pid) ? ` in process ${String(owner.pid)}` : ""}; lock: ${path}`);
- }
- await sleep(25);
- continue;
- }
- try {
- await lock.writeFile(JSON.stringify({ pid: process.pid }), "utf8");
- return await runLocked();
- } finally {
- await lock.close();
- await rm(path, { force: true });
- }
- }
-}
-
async function rotateLog(path: string): Promise<void> {
let size = 0;
try {
@@ -258,8 +214,7 @@ export async function bringManagedProgramsUp(
): Promise<{ readonly dataRoot: string; readonly programs: readonly ManagedProgramReport[] }> {
const { dataRoot, programs } = await declaredManagedPrograms(path, options);
const reports = await Promise.all(distinct(programs).map(async ({ program, instances }) =>
- await withProgramLifecycleLock(dataRoot, program.id, options.maxWaitMs ?? 300_000, async () =>
- await bringUp(dataRoot, program, instances, options.maxWaitMs ?? 300_000, options.onProgress))));
+ await bringUp(dataRoot, program, instances, options.maxWaitMs ?? 300_000, options.onProgress)));
return { dataRoot, programs: reports };
}
@@ -269,8 +224,7 @@ export async function takeManagedProgramsDown(
options: ManagedProgramOptions = {},
): Promise<{ readonly dataRoot: string; readonly programs: readonly ManagedProgramReport[] }> {
const { dataRoot, programs } = await declaredManagedPrograms(path, options);
- const reports = await Promise.all(distinct(programs).map(async ({ program, instances }): Promise<ManagedProgramReport> =>
- await withProgramLifecycleLock(dataRoot, program.id, 30_000, async () => {
+ const reports = await Promise.all(distinct(programs).map(async ({ program, instances }): Promise<ManagedProgramReport> => {
const base = { id: program.id, instances };
const pid = await readPid(dataRoot, program.id);
if (pid === undefined || !alive(pid)) {
@@ -312,7 +266,7 @@ export async function takeManagedProgramsDown(
}
await rm(join(directory(dataRoot), `${program.id}.pid`), { force: true });
return { ...base, action: "stopped", state: await program.probe(), pid };
- })));
+ }));
return { dataRoot, programs: reports };
}
diff --git a/packages/runtime-local/src/runtime.ts b/packages/runtime-local/src/runtime.ts
index 5a90668b..b458a014 100644
--- a/packages/runtime-local/src/runtime.ts
+++ b/packages/runtime-local/src/runtime.ts
@@ -61,6 +61,24 @@ export async function createLocalRuntime(
registerProducerFacets(producers, component.producers ?? []);
}
for (const endpoint of options.endpoints ?? []) await endpoint.install(endpoints);
+ const loadedComponentPackages = new Set<string>();
+ let componentInstallation = Promise.resolve();
+ const installComponentPackages = async (specifiers: readonly string[]): Promise<void> => {
+ const task = componentInstallation.then(async () => {
+ const missing = [...new Set(specifiers)].filter((item) => !loadedComponentPackages.has(item));
+ if (missing.length === 0) return;
+ assert(options.loadComponentPackages !== undefined,
+ `Build requires component package ${missing[0]} but this Runtime cannot load installed packages`);
+ const components = await options.loadComponentPackages(missing);
+ for (const component of components) {
+ registerTypeValidatorFacets(validators, component.validators ?? []);
+ registerProducerFacets(producers, component.producers ?? []);
+ }
+ for (const item of missing) loadedComponentPackages.add(item);
+ });
+ componentInstallation = task.then(() => undefined, () => undefined);
+ await task;
+ };
const driver = new NodeDriver({
producers,
endpoints,
@@ -77,7 +95,7 @@ export async function createLocalRuntime(
dispatch: options.dispatchStore,
},
scheduling,
- implementationPackages: [...new Set(options.implementationPackages ?? [])],
+ installComponentPackages,
});
const credentialControl = createLocalCredentialControl({
credentialStore: options.credentialStore,
@@ -141,7 +159,7 @@ export async function createLocalRuntime(
await options.buildStore.create(request.id, request.definition);
await options.dispatchStore.create({
build: request.id,
- implementationPackages: [...new Set(request.implementationPackages ?? [])].sort(),
+ componentPackages: [...new Set(request.componentPackages ?? [])].sort(),
});
if (request.catalog !== undefined) {
await buildCatalog!.record(request.id, request.catalog);
@@ -170,9 +188,6 @@ export async function createLocalRuntime(
...control,
...credentialControl,
build: runBuild,
- async buildMany(requests) {
- return await Promise.all(requests.map(submit));
- },
async workOnce() {
return await worker.runOnce();
},
diff --git a/packages/runtime-local/src/types.ts b/packages/runtime-local/src/types.ts
index 6bb8b225..8c328cbc 100644
--- a/packages/runtime-local/src/types.ts
+++ b/packages/runtime-local/src/types.ts
@@ -1,22 +1,26 @@
import type { Awaitable, ComponentPackage } from "@narratage/component-kit";
-import type { ArtifactAttachment } from "@narratage/workspace";
import type { EndpointPackage } from "@narratage/endpoint-kit";
-import type { BuildDefinition, BuildState } from "@narratage/protocol";
-import type { Digest } from "@narratage/protocol";
import type {
ArtifactStore,
BuildCatalog,
- BuildCatalogDescriptor,
- BuildCatalogEntry,
BuildSchedulerOptions,
- BuildSnapshot,
BuildStore,
BuildDispatchStore,
BuildDispatchSnapshot,
CredentialStore,
OperationStore,
- OperationSnapshot,
} from "@narratage/runtime";
+import type {
+ RuntimeHostArchive,
+ RuntimeHostArtifactAccess,
+ RuntimeHostArtifactGarbageCollection,
+ RuntimeHostBuildSubmission,
+ RuntimeHostCredentialControl,
+ RuntimeHostCredentialStatus,
+ RuntimeHostExecution,
+ RuntimeHostMaintenance,
+ RuntimeHostStatus,
+} from "@narratage/runtime-host-node";
import type { TypeValidatorRegistrar, TypeValidatorRegistryLike } from "@narratage/validation";
export type { ComponentPackage } from "@narratage/component-kit";
@@ -34,8 +38,8 @@ export type CreateLocalRuntimeOptions = {
readonly artifactStore: ArtifactStore;
readonly credentialStore: CredentialStore;
readonly components?: readonly ComponentPackage[];
- /** Package specifiers already loaded into this Worker process. */
- readonly implementationPackages?: readonly string[];
+ /** Load the component packages named by a claimed Build. */
+ readonly loadComponentPackages?: (specifiers: readonly string[]) => Awaitable<readonly ComponentPackage[]>;
readonly endpoints?: readonly EndpointPackage[];
readonly scheduling: Omit<BuildSchedulerOptions, "buildStore">;
readonly validators?: LocalTypeValidatorRegistry;
@@ -66,121 +70,27 @@ export type CreateLocalCredentialControlOptions = {
readonly close?: () => Awaitable<void>;
};
-export type LocalBuildRequest = {
- /** Caller-generated identity for one submission; Source identity is separate. */
- readonly id: string;
- readonly definition: BuildDefinition;
- /** Installed compute packages selected by this Build's Source closure. */
- readonly implementationPackages?: readonly string[];
- /** Source aliases and paths for Host inspection. Not trusted Build input. */
- readonly catalog?: BuildCatalogDescriptor;
- /** Host transfer bundle. It is staged before Core commands run and never enters BuildState. */
- readonly attachments?: readonly ArtifactAttachment[];
-};
-
-export type LocalBuildOptions = {
- /** Observe the durable Dispatch until terminal; execution remains owned by a Worker process. */
- readonly follow?: boolean;
- readonly pollIntervalMs?: number;
- readonly maxWaitMs?: number;
- readonly signal?: AbortSignal;
-};
-
-export type LocalRuntimeStatus = {
- readonly build: BuildSnapshot | undefined;
- readonly catalog: BuildCatalogEntry | undefined;
- readonly operations: readonly OperationSnapshot[];
- readonly dispatch: BuildDispatchSnapshot | undefined;
-};
-
-/** Lightweight execution facts. Unlike status(), this does not read or verify the BuildState. */
-export type LocalRuntimeActivity = {
- readonly operations: readonly OperationSnapshot[];
- readonly dispatch: BuildDispatchSnapshot | undefined;
-};
-
-export type LocalRuntimeQueue = {
- readonly dispatches: readonly BuildDispatchSnapshot[];
- readonly capacity: readonly import("@narratage/runtime").CapacityReservation[];
- /** Execution facts belonging to non-terminal queued Builds. */
- readonly operations: readonly OperationSnapshot[];
-};
-
-export type LocalCredentialStatus = import("@narratage/endpoint-kit").EndpointCredentialDescription & {
- readonly configured: boolean;
- readonly writable: boolean;
-};
-
-export type LocalBuildSubmission = {
- readonly id: string;
- readonly state: BuildState;
- readonly status: "queued" | "running" | "waiting" | "complete" | "failed" | "cancelled";
- readonly dispatch: BuildDispatchSnapshot;
-};
-
-export type ArtifactGarbageCollection = {
- readonly reachable: readonly Digest[];
- readonly unreachable: readonly Digest[];
- readonly deleted: readonly Digest[];
-};
+export type LocalBuildRequest = Parameters<RuntimeHostExecution["build"]>[0];
+export type LocalBuildOptions = Parameters<RuntimeHostExecution["build"]>[1];
+export type LocalBuildSubmission = RuntimeHostBuildSubmission;
+export type LocalRuntimeStatus = RuntimeHostStatus;
+export type LocalRuntimeActivity = Awaited<ReturnType<RuntimeHostArchive["activity"]>>;
+export type LocalRuntimeQueue = Awaited<ReturnType<RuntimeHostArchive["queue"]>>;
+export type LocalCredentialStatus = RuntimeHostCredentialStatus;
+export type ArtifactGarbageCollection = RuntimeHostArtifactGarbageCollection;
-export type LocalRuntime = {
- build(request: LocalBuildRequest, options?: LocalBuildOptions): Promise<LocalBuildSubmission>;
- buildMany(requests: readonly LocalBuildRequest[]): Promise<readonly LocalBuildSubmission[]>;
- status(build: string): Promise<LocalRuntimeStatus>;
- activity(build: string): Promise<LocalRuntimeActivity>;
- queue(): Promise<LocalRuntimeQueue>;
- operation(id: string): Promise<OperationSnapshot | undefined>;
- credentials(endpoint?: string): Promise<readonly LocalCredentialStatus[]>;
- putCredential(endpoint: string, slot: string, secret: string): Promise<LocalCredentialStatus>;
- deleteCredential(endpoint: string, slot: string): Promise<{ readonly deleted: boolean; readonly credential: LocalCredentialStatus }>;
- builds(): Promise<readonly BuildCatalogEntry[]>;
- cancel(build: string, reason?: string): Promise<BuildDispatchSnapshot | undefined>;
+export type LocalRuntime = RuntimeHostExecution & {
workOnce(): Promise<BuildDispatchSnapshot | undefined>;
- work(options: import("@narratage/runtime").RuntimeWorkerRunOptions): Promise<void>;
- readArtifact(digest: Digest): Promise<Uint8Array | undefined>;
- openArtifact(digest: Digest): Promise<AsyncIterable<Uint8Array> | undefined>;
- /** Explicit maintenance only. apply=false is a read-only reachability report. */
- garbageCollectArtifacts(options?: { readonly apply?: boolean }): Promise<ArtifactGarbageCollection>;
- close(): Awaitable<void>;
};
/** Durable execution-state archive that never opens the selected ArtifactStore. */
-export type LocalRuntimeArchiveControl = Pick<LocalRuntime,
- | "status"
- | "activity"
- | "queue"
- | "operation"
- | "builds"
- | "cancel"
- | "close"
->;
+export type LocalRuntimeArchiveControl = RuntimeHostArchive;
/** Explicit Artifact byte access that never opens Build, Operation or Dispatch state. */
-export type LocalRuntimeArtifactAccess = Pick<LocalRuntime,
- | "readArtifact"
- | "openArtifact"
- | "close"
->;
+export type LocalRuntimeArtifactAccess = RuntimeHostArtifactAccess;
/** Durable project control used only when one operation truly spans state and Artifacts. */
-export type LocalRuntimeControl = Pick<LocalRuntime,
- | "status"
- | "activity"
- | "queue"
- | "operation"
- | "builds"
- | "cancel"
- | "readArtifact"
- | "openArtifact"
- | "garbageCollectArtifacts"
- | "close"
->;
+export type LocalRuntimeControl = RuntimeHostMaintenance;
/** Credential control for one or more exact Endpoint declarations; no execution state is opened. */
-export type LocalCredentialControl = Pick<LocalRuntime,
- | "credentials"
- | "putCredential"
- | "deleteCredential"
- | "close"
->;
+export type LocalCredentialControl = RuntimeHostCredentialControl;
diff --git a/packages/runtime-local/src/worker-process.ts b/packages/runtime-local/src/worker-process.ts
index ac7778ec..d99be7f6 100644
--- a/packages/runtime-local/src/worker-process.ts
+++ b/packages/runtime-local/src/worker-process.ts
@@ -13,7 +13,6 @@ export type RuntimeProcessState = {
readonly profile: string;
readonly pid?: number;
readonly startedAt?: number;
- readonly implementationPackages?: readonly string[];
readonly logPath: string;
};
@@ -21,7 +20,6 @@ type ProcessRecord = {
readonly profile: string;
readonly pid: number;
readonly startedAt: number;
- readonly implementationPackages: readonly string[];
};
const LOG_TAIL_BYTES = 1024 * 1024;
@@ -38,7 +36,6 @@ function paths(dataRoot: string) {
pid: join(root, "worker.json"),
ready: join(root, "ready"),
log: join(root, "worker.log"),
- lock: join(root, "lifecycle.lock"),
};
}
@@ -64,45 +61,6 @@ function alive(pid: number): boolean {
}
}
-async function withLifecycleLock<T>(dataRoot: string, timeoutMs: number, run: () => Promise<T>): Promise<T> {
- const location = paths(dataRoot);
- await mkdir(location.root, { recursive: true });
- const deadline = Date.now() + timeoutMs;
- while (true) {
- let lock;
- try {
- lock = await open(location.lock, "wx");
- } catch (error) {
- if (!nodeError(error, "EEXIST")) throw error;
- let owner: { readonly pid?: unknown } | undefined;
- try {
- owner = JSON.parse(await readFile(location.lock, "utf8")) as { readonly pid?: unknown };
- } catch (readError) {
- if (nodeError(readError, "ENOENT")) continue;
- if (Date.now() >= deadline) throw new Error(`Runtime lifecycle lock is unreadable: ${location.lock}`);
- await new Promise((resolveWait) => setTimeout(resolveWait, 25));
- continue;
- }
- if (Number.isSafeInteger(owner.pid) && !alive(owner.pid as number)) {
- await rm(location.lock, { force: true });
- continue;
- }
- if (Date.now() >= deadline) {
- throw new Error(`Runtime lifecycle is busy${Number.isSafeInteger(owner.pid) ? ` in process ${String(owner.pid)}` : ""}; lock: ${location.lock}`);
- }
- await new Promise((resolveWait) => setTimeout(resolveWait, 25));
- continue;
- }
- try {
- await lock.writeFile(JSON.stringify({ pid: process.pid }), "utf8");
- return await run();
- } finally {
- await lock.close();
- await rm(location.lock, { force: true });
- }
- }
-}
-
async function rotateLog(path: string): Promise<void> {
let size = 0;
try {
@@ -122,9 +80,7 @@ async function record(profile: string, dataRoot: string): Promise<ProcessRecord
const value = JSON.parse(await readFile(path, "utf8")) as ProcessRecord;
if (value.profile !== resolve(profile)
|| !Number.isSafeInteger(value.pid) || value.pid < 1
- || !Number.isSafeInteger(value.startedAt) || value.startedAt < 0
- || !Array.isArray(value.implementationPackages)
- || !value.implementationPackages.every((item) => typeof item === "string" && item.length > 0)) {
+ || !Number.isSafeInteger(value.startedAt) || value.startedAt < 0) {
throw new Error(`Runtime Worker record is invalid: ${path}`);
}
return value;
@@ -137,23 +93,17 @@ async function record(profile: string, dataRoot: string): Promise<ProcessRecord
export async function runtimeProcessStatus(
profile: string,
dataRoot: string,
- requiredImplementationPackages: readonly string[] = [],
): Promise<RuntimeProcessState> {
const location = paths(dataRoot);
const current = await record(profile, dataRoot);
if (current === undefined || !alive(current.pid)) {
return { state: "stopped", profile: resolve(profile), logPath: location.log };
}
- const currentPackages = new Set(current.implementationPackages);
- if (requiredImplementationPackages.some((item) => !currentPackages.has(item))) {
- return { state: "stopped", profile: current.profile, logPath: location.log };
- }
return {
state: "running",
profile: current.profile,
pid: current.pid,
startedAt: current.startedAt,
- implementationPackages: current.implementationPackages,
logPath: location.log,
};
}
@@ -162,12 +112,11 @@ async function waitForReady(
profile: string,
dataRoot: string,
timeoutMs: number,
- implementationPackages: readonly string[],
): Promise<RuntimeProcessState> {
const location = paths(dataRoot);
const deadline = Date.now() + timeoutMs;
while (Date.now() <= deadline) {
- const state = await runtimeProcessStatus(profile, dataRoot, implementationPackages);
+ const state = await runtimeProcessStatus(profile, dataRoot);
if (state.state === "stopped") {
let log = "";
try {
@@ -188,47 +137,42 @@ export async function ensureRuntimeProcess(
dataRoot: string,
launch: RuntimeWorkerLaunch,
timeoutMs = 10_000,
- implementationPackages: readonly string[] = [],
): Promise<RuntimeProcessState> {
- return await withLifecycleLock(dataRoot, timeoutMs, async () => {
- const selectedPackages = [...new Set(implementationPackages)].sort();
- const existing = await record(profile, dataRoot);
- const current = await runtimeProcessStatus(profile, dataRoot, selectedPackages);
- if (current.state === "running") return current;
- if (existing !== undefined && alive(existing.pid)) {
- await stopRuntimeProcessUnlocked(profile, dataRoot, timeoutMs);
- }
- const absolute = resolve(profile);
- const location = paths(dataRoot);
- await mkdir(location.root, { recursive: true });
- await rm(location.ready, { force: true });
- await rotateLog(location.log);
- const log = await open(location.log, "a");
- const child = spawn(launch.command, [
- ...launch.args,
- "_worker",
- absolute,
- "--ready-file",
- location.ready,
- ...(launch.workerArgs ?? []),
- ], {
- cwd: process.cwd(),
- detached: true,
- stdio: ["ignore", log.fd, log.fd],
- env: process.env,
- });
- if (child.pid === undefined) throw new Error("Runtime Worker process has no pid");
- const startedAt = Date.now();
- await writeFile(location.pid, JSON.stringify({
- profile: absolute,
- pid: child.pid,
- startedAt,
- implementationPackages: selectedPackages,
- } satisfies ProcessRecord), "utf8");
- child.unref();
- await log.close();
- return await waitForReady(absolute, dataRoot, timeoutMs, selectedPackages);
+ const existing = await record(profile, dataRoot);
+ const current = await runtimeProcessStatus(profile, dataRoot);
+ if (current.state === "running") return current;
+ if (existing !== undefined && alive(existing.pid)) {
+ await stopRuntimeProcessUnlocked(profile, dataRoot, timeoutMs);
+ }
+ const absolute = resolve(profile);
+ const location = paths(dataRoot);
+ await mkdir(location.root, { recursive: true });
+ await rm(location.ready, { force: true });
+ await rotateLog(location.log);
+ const log = await open(location.log, "a");
+ const child = spawn(launch.command, [
+ ...launch.args,
+ "_worker",
+ absolute,
+ "--ready-file",
+ location.ready,
+ ...(launch.workerArgs ?? []),
+ ], {
+ cwd: process.cwd(),
+ detached: true,
+ stdio: ["ignore", log.fd, log.fd],
+ env: process.env,
});
+ if (child.pid === undefined) throw new Error("Runtime Worker process has no pid");
+ const startedAt = Date.now();
+ await writeFile(location.pid, JSON.stringify({
+ profile: absolute,
+ pid: child.pid,
+ startedAt,
+ } satisfies ProcessRecord), "utf8");
+ child.unref();
+ await log.close();
+ return await waitForReady(absolute, dataRoot, timeoutMs);
}
async function stopRuntimeProcessUnlocked(profile: string, dataRoot: string, timeoutMs: number): Promise<RuntimeProcessState> {
@@ -260,8 +204,7 @@ async function stopRuntimeProcessUnlocked(profile: string, dataRoot: string, tim
}
export async function stopRuntimeProcess(profile: string, dataRoot: string, timeoutMs = 10_000): Promise<RuntimeProcessState> {
- return await withLifecycleLock(dataRoot, timeoutMs, async () =>
- await stopRuntimeProcessUnlocked(profile, dataRoot, timeoutMs));
+ return await stopRuntimeProcessUnlocked(profile, dataRoot, timeoutMs);
}
export async function runtimeProcessLogs(dataRoot: string): Promise<{ readonly path: string; readonly text: string }> {
diff --git a/packages/runtime-local/src/worker.ts b/packages/runtime-local/src/worker.ts
index d3339fb8..09b87da4 100644
--- a/packages/runtime-local/src/worker.ts
+++ b/packages/runtime-local/src/worker.ts
@@ -18,7 +18,7 @@ type LocalWorkerOptions = {
readonly dispatch: import("@narratage/runtime").BuildDispatchStore;
};
readonly scheduling: BuildSchedulerOptions;
- readonly implementationPackages: readonly string[];
+ readonly installComponentPackages: (specifiers: readonly string[]) => Promise<void>;
};
function assert(condition: unknown, message: string): asserts condition {
@@ -219,13 +219,14 @@ class DurableLocalWorker {
async #runClaimed(dispatch: BuildDispatchSnapshot): Promise<BuildDispatchSnapshot> {
if (dispatch.cancellation !== undefined) return await this.#cancel(dispatch);
- const stored = await this.#options.stores.builds.read(dispatch.build);
- assert(stored !== undefined, `Dispatch ${dispatch.build} has no Build Definition`);
- const scheduler = new LocalBuildScheduler(this.#executorWithCapacity, {
- ...this.#options.scheduling,
- buildStore: this.#options.stores.builds,
- });
try {
+ await this.#options.installComponentPackages(dispatch.componentPackages);
+ const stored = await this.#options.stores.builds.read(dispatch.build);
+ assert(stored !== undefined, `Dispatch ${dispatch.build} has no Build Definition`);
+ const scheduler = new LocalBuildScheduler(this.#executorWithCapacity, {
+ ...this.#options.scheduling,
+ buildStore: this.#options.stores.builds,
+ });
const [result] = await scheduler.run([{ id: dispatch.build, state: stored.state, snapshot: stored }]);
assert(result !== undefined, `Scheduler returned no result for ${dispatch.build}`);
const current = await this.#options.stores.dispatch.read(dispatch.build);
@@ -268,10 +269,7 @@ class DurableLocalWorker {
}
async runOnce(): Promise<BuildDispatchSnapshot | undefined> {
- const dispatch = await this.#options.stores.dispatch.claim(
- Date.now(),
- this.#options.implementationPackages,
- );
+ const dispatch = await this.#options.stores.dispatch.claim(Date.now());
return dispatch === undefined ? undefined : await this.#runClaimed(dispatch);
}
@@ -286,10 +284,7 @@ class DurableLocalWorker {
};
while (options.signal?.aborted !== true) {
while (active.size < maxBuilds) {
- const dispatch = await this.#options.stores.dispatch.claim(
- Date.now(),
- this.#options.implementationPackages,
- );
+ const dispatch = await this.#options.stores.dispatch.claim(Date.now());
if (dispatch === undefined) break;
launch(dispatch);
}
diff --git a/packages/runtime-local/test/local.test.ts b/packages/runtime-local/test/local.test.ts
index d4d5dc5e..94678c75 100644
--- a/packages/runtime-local/test/local.test.ts
+++ b/packages/runtime-local/test/local.test.ts
@@ -20,7 +20,7 @@ import type {
EndpointPackage,
} from "@narratage/runtime-local";
import { createLocalRuntime } from "@narratage/runtime-local";
-import { buildDefinition } from "@narratage/core";
+import { defineBuild } from "@narratage/core";
import {
collectNodePackageComponents,
loadNodePackageSelection,
@@ -39,6 +39,10 @@ import {
const providerModule = { name: "example.local-endpoint", version: "1" } as const;
+function definition(state: ReturnType<typeof createGreetingBuild>) {
+ return defineBuild(state.program, state.graph, state.request);
+}
+
function projectRuntimeFixture(directory: string) {
const state = new SqliteRuntimeState(join(directory, ".narratage", "runtime.sqlite"));
return {
@@ -63,7 +67,7 @@ test("Artifact GC is explicit, dry-run by default, and only removes unreachable
assert.deepEqual(preview.unreachable, [orphan.digest]);
assert.deepEqual(preview.deleted, []);
assert.equal(await artifacts.has(orphan.digest), true);
- await runtime.build({ id: "active-build", definition: buildDefinition(createGreetingBuild()) });
+ await runtime.build({ id: "active-build", definition: definition(createGreetingBuild()) });
await assert.rejects(
async () => await runtime.garbageCollectArtifacts({ apply: true }),
/Artifact GC cannot delete while 1 Build is active/u,
@@ -219,7 +223,7 @@ test("project local runtime queues, polls and cancels work with replaceable pack
components: [components],
endpoints: [endpointPackage],
});
- const first = await firstRuntime.build({ id: "greeting-build", definition: buildDefinition(initial), catalog });
+ const first = await firstRuntime.build({ id: "greeting-build", definition: definition(initial), catalog });
assert.equal(first.status, "queued");
assert.equal((await firstRuntime.workOnce())?.phase, "waiting");
assert.equal(starts, 1);
@@ -236,7 +240,7 @@ test("project local runtime queues, polls and cancels work with replaceable pack
assert.equal(clientStatus.catalog?.aliases[0]?.name, "final.document");
assert.deepEqual((await firstRuntime.builds()).map((item) => item.build), ["greeting-build"]);
- await firstRuntime.build({ id: "greeting-follow", definition: buildDefinition(createGreetingBuild()) });
+ await firstRuntime.build({ id: "greeting-follow", definition: definition(createGreetingBuild()) });
await firstRuntime.workOnce();
await firstRuntime.workOnce();
const followed = await firstRuntime.status("greeting-follow");
@@ -247,7 +251,7 @@ test("project local runtime queues, polls and cancels work with replaceable pack
assert.equal(followedStatus.build?.state.status, "complete");
assert.equal(followedStatus.operations.length, 1);
- const waiting = await firstRuntime.build({ id: "greeting-cancel", definition: buildDefinition(createGreetingBuild()) });
+ const waiting = await firstRuntime.build({ id: "greeting-cancel", definition: definition(createGreetingBuild()) });
assert.equal(waiting.status, "queued");
await firstRuntime.workOnce();
const requested = await firstRuntime.cancel("greeting-cancel");
@@ -308,12 +312,10 @@ test("one local Worker advances independent Builds concurrently under one comman
const runtime = await createLocalRuntime({
...projectRuntimeFixture(directory),
components: [components],
- implementationPackages: ["@example/parallel-a", "@example/parallel-b"],
});
- await runtime.buildMany(["parallel-a", "parallel-b"].map((id) => ({
+ await Promise.all(["parallel-a", "parallel-b"].map(async (id) => await runtime.build({
id,
- definition: buildDefinition(createGreetingBuild({ generationRealization: "placeholder" })),
- implementationPackages: [`@example/${id}`],
+ definition: definition(createGreetingBuild({ generationRealization: "placeholder" })),
})));
const controller = new AbortController();
const work = runtime.work({ idlePollMs: 5, signal: controller.signal });
@@ -380,16 +382,19 @@ test("project local runtime accepts components loaded from an installed package"
`, "utf8");
try {
- const loaded = await loadNodePackageSelection(["example-greeting-components"], installedRoot);
const runtime = await createLocalRuntime({
...projectRuntimeFixture(runtimeRoot),
- components: collectNodePackageComponents(loaded.map((item) => item.contribution)),
+ loadComponentPackages: async (specifiers) => {
+ const loaded = await loadNodePackageSelection(specifiers, installedRoot);
+ return collectNodePackageComponents(loaded.map((item) => item.contribution));
+ },
});
const result = await runtime.build({
id: "selected-preview",
- definition: buildDefinition(createGreetingBuild({
+ definition: definition(createGreetingBuild({
generationRealization: "placeholder",
})),
+ componentPackages: ["example-greeting-components"],
});
assert.equal(result.status, "queued");
const completed = await runtime.workOnce();
@@ -420,7 +425,7 @@ test("project local runtime accepts an explicitly selected replacement ArtifactS
assert.equal(await artifactStore.has(sourceArtifact.digest), false);
await runtime.build({
id: "source-artifact-staging",
- definition: buildDefinition(createGreetingBuild()),
+ definition: definition(createGreetingBuild()),
attachments: [{ artifact: sourceArtifact, open: async () => (async function* () { yield bytes; })() }],
});
const failed = await runtime.workOnce();
@@ -429,7 +434,7 @@ test("project local runtime accepts an explicitly selected replacement ArtifactS
let reopened = false;
await runtime.build({
id: "existing-source-artifact",
- definition: buildDefinition(createGreetingBuild()),
+ definition: definition(createGreetingBuild()),
attachments: [{
artifact: sourceArtifact,
open: async () => {
@@ -448,7 +453,7 @@ test("project local runtime accepts an explicitly selected replacement ArtifactS
};
await assert.rejects(runtime.build({
id: "mismatched-source-artifact",
- definition: buildDefinition(createGreetingBuild()),
+ definition: definition(createGreetingBuild()),
attachments: [{
artifact: absentArtifact,
open: async () => (async function* () { yield new Uint8Array([0]); })(),
diff --git a/packages/runtime-local/test/programs.test.ts b/packages/runtime-local/test/programs.test.ts
index 8e68cf1b..ca24d72a 100644
--- a/packages/runtime-local/test/programs.test.ts
+++ b/packages/runtime-local/test/programs.test.ts
@@ -156,27 +156,6 @@ test("up starts the program once for every Endpoint that drives it, and down sto
await rm(root, { recursive: true, force: true });
});
-test("concurrent up calls atomically share one Managed Program process", async () => {
- const markerRoot = await mkdtemp(join(tmpdir(), "narratage-marker-concurrent-"));
- const marker = join(markerRoot, "ready");
- const { root, path, options } = await project(() => fileBackedProgram(marker));
- try {
- const results = await Promise.all(Array.from({ length: 6 }, async () =>
- await bringManagedProgramsUp(path, { ...options, maxWaitMs: 20_000 })));
- assert.equal(results.filter((item) => item.programs[0]!.action === "started").length, 1);
- assert.equal(results.filter((item) => item.programs[0]!.action === "already-running").length, 5);
- const pid = Number.parseInt(await readFile(join(root, "programs", "example.pid"), "utf8"), 10);
- assert.ok(Number.isSafeInteger(pid) && pid > 0);
- await takeManagedProgramsDown(path, options);
- await sleep(100);
- assert.throws(() => process.kill(pid, 0));
- } finally {
- await takeManagedProgramsDown(path, options).catch(() => undefined);
- await rm(root, { recursive: true, force: true });
- await rm(markerRoot, { recursive: true, force: true });
- }
-});
-
test("a program answering with another identity is never joined by a second copy", async () => {
const { path, options } = await project(() => ({
id: "example",
diff --git a/packages/runtime/src/dispatch.ts b/packages/runtime/src/dispatch.ts
index 109d1428..32476f3b 100644
--- a/packages/runtime/src/dispatch.ts
+++ b/packages/runtime/src/dispatch.ts
@@ -3,8 +3,8 @@ export type DispatchTerminal = "complete" | "failed" | "cancelled";
export type BuildDispatchRequest = {
readonly build: string;
- /** Compute packages the Worker loads for this Build. */
- readonly implementationPackages: readonly string[];
+ /** Installed component packages loaded when a Worker claims this Build. */
+ readonly componentPackages: readonly string[];
};
export type BuildDispatchSnapshot = BuildDispatchRequest & {
@@ -71,8 +71,7 @@ export type BuildDispatchStore = {
}): Promise<BuildDispatchSnapshot>;
read(build: string): Promise<BuildDispatchSnapshot | undefined>;
list(query?: DispatchQuery): Promise<readonly BuildDispatchSnapshot[]>;
- /** Claim one ready Build that this Worker has the implementation packages to execute. */
- claim(now?: number, implementationPackages?: readonly string[]): Promise<BuildDispatchSnapshot | undefined>;
+ claim(now?: number): Promise<BuildDispatchSnapshot | undefined>;
release(build: string, update: BuildDispatchRelease): Promise<BuildDispatchSnapshot>;
finish(build: string, terminal: DispatchTerminal, reason?: string): Promise<BuildDispatchSnapshot>;
requestCancellation(build: string, reason?: string): Promise<BuildDispatchSnapshot>;
diff --git a/packages/runtime/src/index.ts b/packages/runtime/src/index.ts
index 59c4accc..eae56651 100644
--- a/packages/runtime/src/index.ts
+++ b/packages/runtime/src/index.ts
@@ -12,9 +12,6 @@ export {
capacityReservationId,
} from "./dispatch.js";
export type * from "./dispatch.js";
-export {
- MemoryOperationStore,
-} from "./operations.js";
export type * from "./operations.js";
export { LocalBuildScheduler } from "./scheduler.js";
export {
diff --git a/packages/runtime/src/operations.ts b/packages/runtime/src/operations.ts
index 6efe39f8..9bd43577 100644
--- a/packages/runtime/src/operations.ts
+++ b/packages/runtime/src/operations.ts
@@ -71,67 +71,3 @@ export type OperationStore = {
/** One local Worker owns execution. A terminal Operation is returned unchanged. */
update(id: string, update: OperationUpdate): Promise<OperationSnapshot>;
};
-
-function assert(condition: unknown, message: string): asserts condition {
- if (!condition) throw new Error(message);
-}
-
-function copy(snapshot: OperationSnapshot): OperationSnapshot {
- return structuredClone(snapshot);
-}
-
-/** In-process reference Store. */
-export class MemoryOperationStore implements OperationStore {
- readonly #operations = new Map<string, OperationSnapshot>();
-
- async create(operation: OperationSnapshot): Promise<OperationSnapshot> {
- if (this.#operations.has(operation.id)) throw new Error(`Operation ${operation.id} already exists`);
- this.#operations.set(operation.id, copy(operation));
- return copy(operation);
- }
-
- async read(id: string): Promise<OperationSnapshot | undefined> {
- const snapshot = this.#operations.get(id);
- return snapshot === undefined ? undefined : copy(snapshot);
- }
-
- async list(query: OperationQuery): Promise<readonly OperationSnapshot[]> {
- return [...this.#operations.values()]
- .filter((snapshot) => query.build === undefined || snapshot.build === query.build)
- .filter((snapshot) => query.command === undefined || snapshot.command === query.command)
- .filter((snapshot) => query.endpoint === undefined || snapshot.endpoint === query.endpoint)
- .sort((left, right) => left.id.localeCompare(right.id))
- .map(copy);
- }
-
- async update(id: string, update: OperationUpdate): Promise<OperationSnapshot> {
- const current = this.#operations.get(id);
- assert(current !== undefined, `Operation ${id} does not exist`);
- if (current.status === "completed" || current.status === "failed" || current.status === "cancelled") {
- return copy(current);
- }
- const mutable = update.status === "pending"
- ? {
- status: "pending" as const,
- handle: structuredClone(update.handle),
- ...(update.wakeAt === undefined ? {} : { wakeAt: update.wakeAt }),
- ...(update.progress === undefined ? {} : { progress: structuredClone(update.progress) }),
- }
- : update.status === "completed"
- ? { status: "completed" as const, completion: structuredClone(update.completion) }
- : update.status === "failed"
- ? { status: "failed" as const, failure: structuredClone(update.failure) }
- : { status: "cancelled" as const };
- const snapshot: OperationSnapshot = {
- id: current.id,
- build: current.build,
- command: current.command,
- endpoint: current.endpoint,
- pool: current.pool,
- lane: current.lane,
- ...mutable,
- };
- this.#operations.set(id, snapshot);
- return copy(snapshot);
- }
-}
diff --git a/packages/runtime/test/operations.test.ts b/packages/runtime/test/operations.test.ts
deleted file mode 100644
index ee790588..00000000
--- a/packages/runtime/test/operations.test.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import assert from "node:assert/strict";
-import test from "node:test";
-
-import {
- MemoryOperationStore,
-} from "@narratage/runtime";
-
-function operation() {
- return {
- id: "operation:render",
- build: "video-42",
- command: "command:render",
- endpoint: "hyperframes.local",
- pool: "hyperframes.local",
- lane: "render",
- };
-}
-
-test("OperationStore keeps the handle needed to poll external work", async () => {
- const store = new MemoryOperationStore();
- const identity = operation();
- await store.create({ ...identity,
- status: "pending",
- handle: { remoteJob: "job-123" },
- wakeAt: 10_000,
- progress: { phase: "rendering", completed: 12, total: 60, unit: "frames" },
- });
-
- const pending = await store.read(identity.id);
- assert.equal(pending?.status, "pending");
- assert.deepEqual(pending?.handle, { remoteJob: "job-123" });
- assert.deepEqual((await store.list({ build: "video-42" })).map((item) => item.id), [identity.id]);
-});
-
-test("OperationStore records the external result", async () => {
- const store = new MemoryOperationStore();
- const identity = operation();
- const completed = await store.create({ ...identity,
- status: "completed",
- completion: { value: { kind: "inline", value: { artifact: "video.mp4" } } },
- });
- assert.equal(completed.status, "completed");
- assert.equal((await store.read(identity.id))?.status, "completed");
-});
diff --git a/packages/store-sqlite/src/store.ts b/packages/store-sqlite/src/store.ts
index e47d769d..3e9c05a5 100644
--- a/packages/store-sqlite/src/store.ts
+++ b/packages/store-sqlite/src/store.ts
@@ -34,7 +34,7 @@ import type {
OperationUpdate,
} from "@narratage/runtime";
-const databaseSchemaVersion = 12;
+const databaseSchemaVersion = 13;
export type SqliteRuntimeStateOptions = {
readonly busyTimeoutMs?: number;
@@ -336,11 +336,11 @@ class SqliteOperationStore implements OperationStore {
function parseDispatchSnapshot(row: Row): BuildDispatchSnapshot {
assert(typeof row.build_id === "string", "SQLite Dispatch row has no Build id");
- assert(typeof row.implementation_packages_json === "string", "SQLite Dispatch row has no implementation packages");
+ assert(typeof row.component_packages_json === "string", "SQLite Dispatch row has no component packages");
assert(typeof row.created_at === "number", "SQLite Dispatch time is invalid");
assert(typeof row.available_at === "number", "SQLite Dispatch schedule is invalid");
assert(typeof row.phase === "string", "SQLite Dispatch state is invalid");
- const implementationPackages = JSON.parse(row.implementation_packages_json) as readonly string[];
+ const componentPackages = JSON.parse(row.component_packages_json) as readonly string[];
const cancellation = row.cancel_requested === 1
? {
cancellation: {
@@ -350,7 +350,7 @@ function parseDispatchSnapshot(row: Row): BuildDispatchSnapshot {
: {};
const snapshot = {
build: row.build_id,
- implementationPackages,
+ componentPackages,
createdAt: row.created_at,
availableAt: row.available_at,
phase: row.phase,
@@ -376,10 +376,10 @@ class SqliteBuildDispatchStore implements BuildDispatchStore {
nonNegativeInteger(now, "Dispatch creation time");
this.#database.prepare(`
INSERT INTO narratage_dispatches (
- build_id, implementation_packages_json, created_at, available_at,
+ build_id, component_packages_json, created_at, available_at,
phase, reason, cancel_requested, cancel_reason, terminal
) VALUES (?, ?, ?, ?, 'queued', NULL, 0, NULL, NULL)
- `).run(request.build, canonicalStringify(request.implementationPackages), now, now);
+ `).run(request.build, canonicalStringify(request.componentPackages), now, now);
return {
...copy(request),
createdAt: now,
@@ -402,23 +402,15 @@ class SqliteBuildDispatchStore implements BuildDispatchStore {
.filter((item) => query.phases === undefined || query.phases.includes(item.phase));
}
- async claim(
- now = Date.now(),
- implementationPackages: readonly string[] = [],
- ): Promise<BuildDispatchSnapshot | undefined> {
+ async claim(now = Date.now()): Promise<BuildDispatchSnapshot | undefined> {
nonNegativeInteger(now, "Dispatch claim time");
- const available = new Set(implementationPackages);
return transaction(this.#database, () => {
- const rows = this.#database.prepare(`
- SELECT build_id, implementation_packages_json FROM narratage_dispatches
+ const row = this.#database.prepare(`
+ SELECT build_id FROM narratage_dispatches
WHERE phase IN ('queued', 'waiting') AND available_at <= ?
ORDER BY available_at ASC, created_at ASC, build_id ASC
- `).all(now) as Row[];
- const row = rows.find((candidate) => {
- assert(typeof candidate.implementation_packages_json === "string", "SQLite ready Dispatch has no implementation packages");
- const packages = JSON.parse(candidate.implementation_packages_json) as readonly string[];
- return packages.every((item) => available.has(item));
- });
+ LIMIT 1
+ `).get(now) as Row | undefined;
if (row === undefined) return undefined;
assert(typeof row.build_id === "string", "SQLite ready Dispatch has no Build id");
const updated = this.#database.prepare(`
@@ -666,7 +658,7 @@ export class SqliteRuntimeState {
) STRICT;
CREATE TABLE IF NOT EXISTS narratage_dispatches (
build_id TEXT PRIMARY KEY,
- implementation_packages_json TEXT NOT NULL,
+ component_packages_json TEXT NOT NULL,
created_at INTEGER NOT NULL,
available_at INTEGER NOT NULL,
phase TEXT NOT NULL CHECK (phase IN ('queued', 'running', 'waiting', 'terminal')),
diff --git a/packages/store-sqlite/test/store.test.ts b/packages/store-sqlite/test/store.test.ts
index 18bf4d55..929e6252 100644
--- a/packages/store-sqlite/test/store.test.ts
+++ b/packages/store-sqlite/test/store.test.ts
@@ -3,7 +3,7 @@ import { mkdtemp, rm, stat } from "node:fs/promises";
import { join } from "node:path";
import { tmpdir } from "node:os";
import test from "node:test";
-import { BuildMachine, buildDefinition } from "@narratage/core";
+import { BuildMachine, defineBuild } from "@narratage/core";
import { SqliteRuntimeState } from "@narratage/store-sqlite";
import { createGreetingBuild } from "../../core/test/greeting-fixture.js";
@@ -28,7 +28,7 @@ test("SQLite stores verified Build facts and Operation handles across reopen", a
try {
const first = new SqliteRuntimeState(path);
const initial = createGreetingBuild();
- const definition = buildDefinition(initial);
+ const definition = defineBuild(initial.program, initial.graph, initial.request);
await first.builds.create("video", definition);
const catalog = {
source: { path: "/project/main.svml" },
@@ -112,7 +112,7 @@ test("cancelling a never-claimed Build atomically withdraws it from dispatch", a
const directory = await mkdtemp(join(tmpdir(), "narratage-sqlite-cancel-queued-"));
try {
const state = new SqliteRuntimeState(join(directory, "runtime.sqlite"));
- await state.dispatch.create({ build: "queued-build", implementationPackages: [] }, { now: 100 });
+ await state.dispatch.create({ build: "queued-build", componentPackages: [] }, { now: 100 });
const cancelled = await state.dispatch.requestCancellation("queued-build", "no longer needed");
assert.equal(cancelled.phase, "terminal");
@@ -129,28 +129,6 @@ test("cancelling a never-claimed Build atomically withdraws it from dispatch", a
}
});
-test("a Worker skips ready Builds whose implementation packages it has not loaded", async () => {
- const directory = await mkdtemp(join(tmpdir(), "narratage-sqlite-package-admission-"));
- try {
- const state = new SqliteRuntimeState(join(directory, "runtime.sqlite"));
- await state.dispatch.create({
- build: "a-needs-image",
- implementationPackages: ["@example/image"],
- }, { now: 100 });
- await state.dispatch.create({
- build: "b-needs-nothing",
- implementationPackages: [],
- }, { now: 100 });
-
- assert.equal((await state.dispatch.claim(101, []))?.build, "b-needs-nothing");
- assert.equal(await state.dispatch.claim(102, []), undefined);
- assert.equal((await state.dispatch.claim(103, ["@example/image"]))?.build, "a-needs-image");
- state.close();
- } finally {
- await rm(directory, { recursive: true, force: true });
- }
-});
-
test("Pool and Lane limits count only asynchronous Operations still in flight", async () => {
const directory = await mkdtemp(join(tmpdir(), "narratage-sqlite-hierarchy-"));
try {
diff --git a/packages/transport-aws-lambda/package.json b/packages/transport-aws-lambda/package.json
index e152e44b..ec7dae02 100644
--- a/packages/transport-aws-lambda/package.json
+++ b/packages/transport-aws-lambda/package.json
@@ -9,7 +9,6 @@
},
"dependencies": {
"@aws-sdk/client-lambda": "^3.1103.0",
- "@narratage/protocol": "workspace:*",
- "@narratage/transport": "workspace:*"
+ "@narratage/protocol": "workspace:*"
}
}
diff --git a/packages/transport-aws-lambda/src/index.ts b/packages/transport-aws-lambda/src/index.ts
index 460cd672..89f7065e 100644
--- a/packages/transport-aws-lambda/src/index.ts
+++ b/packages/transport-aws-lambda/src/index.ts
@@ -7,7 +7,11 @@ import type {
} from "@aws-sdk/client-lambda";
import { canonicalize } from "@narratage/protocol";
import type { CanonicalValue } from "@narratage/protocol";
-import type { JsonInvoker } from "@narratage/transport";
+
+/** One canonical JSON exchange; callers may inject any structurally compatible transport. */
+export interface JsonInvoker {
+ invoke(request: CanonicalValue, options?: { readonly signal?: AbortSignal }): Promise<CanonicalValue>;
+}
export type LambdaInvocationInput = {
readonly functionName: string;
diff --git a/packages/transport/README.md b/packages/transport/README.md
deleted file mode 100644
index 41e46646..00000000
--- a/packages/transport/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# `@narratage/transport`
-
-Tiny transport contracts with no capability identity, scheduling or recovery authority.
-
-`JsonInvoker` carries one bounded canonical request/response exchange. Process, Lambda, HTTP or RPC
-adapters may implement it; an Endpoint package remains responsible for interpreting the request,
-persisting remote checkpoints and converting a response into an exact capability fulfillment.
diff --git a/packages/transport/package.json b/packages/transport/package.json
deleted file mode 100644
index 1deca605..00000000
--- a/packages/transport/package.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name": "@narratage/transport",
- "version": "0.0.0-dev",
- "license": "SEE LICENSE IN LICENSE",
- "private": true,
- "type": "module",
- "exports": {
- ".": "./src/index.ts"
- },
- "dependencies": {
- "@narratage/protocol": "workspace:*"
- }
-}
diff --git a/packages/transport/src/index.ts b/packages/transport/src/index.ts
deleted file mode 100644
index 277d9445..00000000
--- a/packages/transport/src/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import type { CanonicalValue } from "@narratage/protocol";
-
-/** One canonical JSON exchange; it owns no capability routing or operation semantics. */
-export interface JsonInvoker {
- invoke(request: CanonicalValue, options?: { readonly signal?: AbortSignal }): Promise<CanonicalValue>;
-}
diff --git a/packages/video-cli/package.json b/packages/video-cli/package.json
index 830e778e..6c27487e 100644
--- a/packages/video-cli/package.json
+++ b/packages/video-cli/package.json
@@ -12,7 +12,7 @@
"@narratage/compiler-markup-node": "workspace:*",
"@narratage/markup": "workspace:*",
"@narratage/package-loader-node": "workspace:*",
- "@narratage/runtime-host-node": "workspace:*",
+ "@narratage/runtime-local": "workspace:*",
"@narratage/workspace-fs-node": "workspace:*"
}
}
diff --git a/packages/video-cli/src/distribution.ts b/packages/video-cli/src/distribution.ts
index 31477008..a56b2d29 100644
--- a/packages/video-cli/src/distribution.ts
+++ b/packages/video-cli/src/distribution.ts
@@ -1,5 +1,5 @@
import type { CliDistribution } from "@narratage/cli";
-import { loadNodeRuntimeHost } from "@narratage/runtime-host-node";
+import { openLocalRuntimeHost } from "@narratage/runtime-local";
import { fileURLToPath } from "node:url";
import {
createVideoCompiler,
@@ -17,12 +17,12 @@ export const videoCliDistribution: CliDistribution = {
const { discoverVideoSourcePackages } = await import("./package-selection.js");
return await discoverVideoSourcePackages(path, options);
},
- openRuntimeHost: async (path, options) => await loadNodeRuntimeHost(path, {
+ openRuntimeHost: async (path, options) => await openLocalRuntimeHost(path, {
packageRoot: options.packageRoot,
workerLaunch: {
command: process.execPath,
- // The installed cross-platform bin is self-bootstrapping. Tests and direct
- // source imports retain the explicit TypeScript loader fallback.
+ // The repository launcher registers TypeScript support before entering the CLI.
+ // Tests that import this Distribution directly keep the current Node arguments.
args: installedLauncher === undefined
? [
...process.execArgv.filter((item) => !item.startsWith("--test")),
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ac44c0e5..3bef22ef 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -465,10 +465,6 @@ importers:
'@narratage/workspace':
specifier: workspace:*
version: link:../workspace
- devDependencies:
- '@narratage/runtime-local':
- specifier: workspace:*
- version: link:../runtime-local
packages/comment-sticker:
dependencies:
@@ -543,9 +539,6 @@ importers:
specifier: workspace:*
version: link:../workspace
devDependencies:
- '@narratage/protocol':
- specifier: workspace:*
- version: link:../protocol
'@narratage/workspace-fs-node':
specifier: workspace:*
version: link:../workspace-fs-node
@@ -641,9 +634,6 @@ importers:
packages/credential-store-env:
dependencies:
- '@narratage/protocol':
- specifier: workspace:*
- version: link:../protocol
'@narratage/runtime':
specifier: workspace:*
version: link:../runtime
@@ -653,9 +643,6 @@ importers:
packages/credential-store-keychain:
dependencies:
- '@narratage/protocol':
- specifier: workspace:*
- version: link:../protocol
'@narratage/runtime':
specifier: workspace:*
version: link:../runtime
@@ -1297,11 +1284,7 @@ importers:
specifier: workspace:*
version: link:../text
- packages/host:
- dependencies:
- '@narratage/protocol':
- specifier: workspace:*
- version: link:../protocol
+ packages/host: {}
packages/hyperframes:
dependencies:
@@ -1633,13 +1616,6 @@ importers:
'@narratage/protocol':
specifier: workspace:*
version: link:../protocol
- devDependencies:
- '@narratage/runtime-kit':
- specifier: workspace:*
- version: link:../runtime-kit
- '@narratage/validation':
- specifier: workspace:*
- version: link:../validation
packages/program-space:
dependencies:
@@ -1893,9 +1869,6 @@ importers:
'@narratage/media':
specifier: workspace:*
version: link:../media
- '@narratage/media-execution':
- specifier: workspace:*
- version: link:../media-execution
'@narratage/media-pipeline':
specifier: workspace:*
version: link:../media-pipeline
@@ -1908,9 +1881,6 @@ importers:
'@narratage/speech':
specifier: workspace:*
version: link:../speech
- '@narratage/transport':
- specifier: workspace:*
- version: link:../transport
'@narratage/transport-aws-lambda':
specifier: workspace:*
version: link:../transport-aws-lambda
@@ -2155,12 +2125,6 @@ importers:
packages/runtime-host-node:
dependencies:
- '@narratage/host':
- specifier: workspace:*
- version: link:../host
- '@narratage/package-loader-node':
- specifier: workspace:*
- version: link:../package-loader-node
'@narratage/protocol':
specifier: workspace:*
version: link:../protocol
@@ -2221,9 +2185,6 @@ importers:
'@narratage/validation':
specifier: workspace:*
version: link:../validation
- '@narratage/workspace':
- specifier: workspace:*
- version: link:../workspace
devDependencies:
'@narratage/artifact-store-fs':
specifier: workspace:*
@@ -2620,12 +2581,6 @@ importers:
specifier: workspace:*
version: link:../svs
- packages/transport:
- dependencies:
- '@narratage/protocol':
- specifier: workspace:*
- version: link:../protocol
-
packages/transport-aws-lambda:
dependencies:
'@aws-sdk/client-lambda':
@@ -2634,9 +2589,6 @@ importers:
'@narratage/protocol':
specifier: workspace:*
version: link:../protocol
- '@narratage/transport':
- specifier: workspace:*
- version: link:../transport
packages/typography-track:
dependencies:
@@ -2716,9 +2668,9 @@ importers:
'@narratage/package-loader-node':
specifier: workspace:*
version: link:../package-loader-node
- '@narratage/runtime-host-node':
+ '@narratage/runtime-local':
specifier: workspace:*
- version: link:../runtime-host-node
+ version: link:../runtime-local
'@narratage/workspace-fs-node':
specifier: workspace:*
version: link:../workspace-fs-node
diff --git a/tsconfig.cli.json b/tsconfig.cli.json
deleted file mode 100644
index c4faf784..00000000
--- a/tsconfig.cli.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "extends": "./tsconfig.json",
- "compilerOptions": {
- "noEmit": false,
- "declaration": false,
- "sourceMap": false,
- "outDir": "./dist/cli",
- "incremental": true,
- "tsBuildInfoFile": "./dist/cli.tsbuildinfo"
- },
- "include": [
- "packages/*/src/**/*.ts"
- ],
- "exclude": [
- "node_modules",
- "packages/*/test/**"
- ]
-}