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.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
refactor(video-cli): remove hypit image
kashorin50045c8f917c
diff --git a/docs/guide/component-anatomy.md b/docs/guide/component-anatomy.mdindex be0f85c8..67c5d7d2 100644--- a/docs/guide/component-anatomy.md+++ b/docs/guide/component-anatomy.md@@ -65,10 +65,11 @@ operations followed by a fixed-port append/merge Producer rather than an undecla## Assets a package ships-A component's own chrome — its paper, board, panel, texture or default backdrop — is a file inside-the package, read with `readFile(new URL("../assets/…", import.meta.url))`. So is the preview image-its Surface declares. Neither is an input the installing project supplies, and neither is produced by-a Build: use `hypit image` while authoring the package and commit the result.+A component's own chrome — its paper, board, panel or default backdrop — is drawn by the component's+own code, and the preview image its Surface declares is captured from that rendering. A small static+file a component ships, such as a font or an icon set the author already owns, is read with+`readFile(new URL("../assets/…", import.meta.url))`. None of this is an input the installing project+supplies, and none of it is produced by a Build or by an image model.A component that cannot draw itself without a Source supplying its background is the wrong shape.The symptom is unmistakable — it imports cleanly and renders nothing.diff --git a/packages/video-cli/package.json b/packages/video-cli/package.jsonindex f32d5787..f75fd3c5 100644--- a/packages/video-cli/package.json+++ b/packages/video-cli/package.json@@ -11,15 +11,9 @@"dependencies": {"@hypit/cli": "workspace:*","@hypit/compiler-markup-node": "workspace:*",- "@hypit/credential-store-env": "workspace:*","@hypit/credential-store-os": "workspace:*",- "@hypit/driver-node": "workspace:*",- "@hypit/endpoint-kit": "workspace:*",- "@hypit/generation": "workspace:*","@hypit/markup": "workspace:*",- "@hypit/model-kit": "workspace:*","@hypit/package-loader-node": "workspace:*",- "@hypit/protocol": "workspace:*","@hypit/provider-hypihub": "workspace:*","@hypit/runtime-host-node": "workspace:*","@hypit/runtime-local": "workspace:*",diff --git a/packages/video-cli/src/cli.ts b/packages/video-cli/src/cli.tsindex ffe960fa..d1879461 100644--- a/packages/video-cli/src/cli.ts+++ b/packages/video-cli/src/cli.ts@@ -1,7 +1,6 @@#!/usr/bin/env nodeimport { renderCliError, writeCliHelp } from "@hypit/cli";import type { CliIo } from "@hypit/cli";-import { writeVideoImageHelp } from "./image-command.js";const argv = process.argv.slice(2);const json = argv.includes("--json");@@ -60,11 +59,7 @@ const io: CliIo = {async function main(): Promise<void> {if (argv.length === 0 || argv[0] === "help" || argv.includes("--help")) {const topic = argv[0] === "help" ? argv[1] : argv.includes("--help") ? argv[0] : undefined;- if (topic === "image") writeVideoImageHelp(io);- else {- writeCliHelp(io, topic);- if (topic === undefined) io.write("\nVideo utility\n image --prompt <text|file> --to <path> create authoring input\n");- }+ writeCliHelp(io, topic);return;}const { runVideoCli } = await import("./index.js");diff --git a/packages/video-cli/src/image-command.ts b/packages/video-cli/src/image-command.tsdeleted file mode 100644index 6e1d63c7..00000000--- a/packages/video-cli/src/image-command.ts+++ /dev/null@@ -1,126 +0,0 @@-import { mkdir, readFile, stat, writeFile } from "node:fs/promises";-import { dirname, resolve } from "node:path";--import type { CliIo } from "@hypit/cli";--import { generateVideoCliPicture } from "./picture.js";--type ImageArgs = {- readonly prompt: string;- readonly to: string;- readonly model?: string;- readonly aspectRatio?: string;- readonly resolution?: string;- readonly json: boolean;-};--async function nearestPackageRoot(start: string): Promise<string> {- let directory = resolve(start);- while (true) {- const manifest = resolve(directory, "package.json");- if (await stat(manifest).then((item) => item.isFile(), () => false)) return directory;- const parent = dirname(directory);- if (parent === directory) return resolve(start);- directory = parent;- }-}--async function promptText(value: string): Promise<string> {- const path = resolve(value);- const isFile = await stat(path).then((item) => item.isFile(), () => false);- const prompt = (isFile ? await readFile(path, "utf8") : value).trim();- if (prompt.length === 0) throw new Error(isFile ? `prompt file ${path} is empty` : "--prompt is empty");- return prompt;-}--function parseImageArgs(argv: readonly string[]): ImageArgs {- let prompt: string | undefined;- let to: string | undefined;- let model: string | undefined;- let aspectRatio: string | undefined;- let resolution: string | undefined;- let json = false;- const seen = new Set<string>();- for (let index = 1; index < argv.length; index += 1) {- const option = argv[index]!;- if (option === "--json") { json = true; continue; }- if (option === "--debug" || option === "--verbose" || option === "--no-color") continue;- if (option === "--color") {- const value = argv[index + 1];- if (value !== "auto" && value !== "always" && value !== "never") {- throw new Error("--color requires auto, always or never");- }- index += 1;- continue;- }- if (!["--prompt", "--to", "--model", "--aspect-ratio", "--resolution"].includes(option)) {- throw new Error(`unknown option ${option}`);- }- if (seen.has(option)) throw new Error(`${option} cannot be repeated`);- seen.add(option);- const value = argv[index + 1];- if (value === undefined || value.startsWith("--")) throw new Error(`${option} requires a value`);- if (option === "--prompt") prompt = value;- else if (option === "--to") to = resolve(value);- else if (option === "--model") model = value;- else if (option === "--aspect-ratio") aspectRatio = value;- else resolution = value;- index += 1;- }- if (prompt === undefined) throw new Error("image requires --prompt with text or a text file path");- if (to === undefined) throw new Error("image requires --to with the file to write");- return { prompt, to, json, ...(model === undefined ? {} : { model }),- ...(aspectRatio === undefined ? {} : { aspectRatio }),- ...(resolution === undefined ? {} : { resolution }) };-}--export function writeVideoImageHelp(io: CliIo): void {- io.write([- "hypit image",- "Generate one image file used as video authoring input.",- "",- " hypit image --prompt <text|file> --to <path> [--model <package>]",- " [--aspect-ratio <ratio>] [--resolution <size>]",- "",- "This is a video-distribution utility. It creates no Build or Result.",- "",- ].join("\n"));-}--export async function runVideoImageCli(- argv: readonly string[],- io: CliIo,- distributionPackageRoot?: string,-): Promise<void> {- const args = parseImageArgs(argv);- if (await stat(args.to).then(() => true, () => false)) {- throw new Error(`Image destination ${args.to} already exists`);- }- const picture = await generateVideoCliPicture({- prompt: await promptText(args.prompt),- packageRoot: await nearestPackageRoot(process.cwd()),- ...(distributionPackageRoot === undefined ? {} : { distributionPackageRoot }),- ...(args.model === undefined ? {} : { model: args.model }),- ...(args.aspectRatio === undefined ? {} : { aspectRatio: args.aspectRatio }),- ...(args.resolution === undefined ? {} : { resolution: args.resolution }),- });- await mkdir(dirname(args.to), { recursive: true });- try {- await writeFile(args.to, picture.bytes, { flag: "wx" });- } catch (error) {- if (error instanceof Error && "code" in error && error.code === "EEXIST") {- throw new Error(`Image destination ${args.to} already exists`);- }- throw error;- }- const view = {- format: "hypit.video-cli-image@1",- model: picture.model,- package: picture.package,- mediaType: picture.mediaType,- bytes: picture.bytes.byteLength,- path: args.to,- } as const;- if (args.json) io.write(`${JSON.stringify(view, null, 2)}\n`);- else io.write(`✓ Picture written\n\n ${picture.model} · ${picture.mediaType}\n ${args.to}\n`);-}diff --git a/packages/video-cli/src/index.ts b/packages/video-cli/src/index.tsindex 418464d8..7880f312 100644--- a/packages/video-cli/src/index.ts+++ b/packages/video-cli/src/index.ts@@ -8,8 +8,6 @@ import { hypitHostPackageRoot } from "@hypit/runtime-host-node";import type { LoadedPackage } from "@hypit/package-loader-node";import { videoCliDistribution } from "./distribution.js";-import { runVideoImageCli } from "./image-command.js";-import { writeVideoImageHelp } from "./image-command.js";export {createVideoCompiler,@@ -28,14 +26,6 @@ export function runVideoCli(? []: [videoCliDistribution.packageRoot]);installExternalPackageResolution([hypitHostPackageRoot()]);- if ((argv[0] === "image" && argv.includes("--help"))- || (argv[0] === "help" && argv[1] === "image")) {- writeVideoImageHelp(io);- return Promise.resolve();- }- if (argv[0] === "image") {- return runVideoImageCli(argv, io, videoCliDistribution.packageRoot);- }return runCli(argv, io, {...videoCliDistribution,bootstrapPackages: packages,diff --git a/packages/video-cli/src/picture.ts b/packages/video-cli/src/picture.tsdeleted file mode 100644index 52279be7..00000000--- a/packages/video-cli/src/picture.ts+++ /dev/null@@ -1,200 +0,0 @@-import { EnvironmentCredentialStore } from "@hypit/credential-store-env";-import { OsCredentialStore } from "@hypit/credential-store-os";-import { EndpointRegistry, MemoryResourceStore } from "@hypit/driver-node";-import type { EndpointRegistration } from "@hypit/driver-node";-import type { EndpointOutcome } from "@hypit/endpoint-kit";-import { sealGenerationPortRequest, verifyGeneratedImageSet } from "@hypit/generation";-import type { GenerationPort, GenerationPortValue } from "@hypit/generation";-import { exactModelsFromHostFacets } from "@hypit/model-kit";-import type { ExactModelEndpoint } from "@hypit/model-kit";-import { loadNodePackageSelection } from "@hypit/package-loader-node";-import type { BlobRef, CanonicalValue, Need } from "@hypit/protocol";-import { createHypiHubProvider } from "@hypit/provider-hypihub";--/**- * The exact model family this Distribution reaches for when the author names none.- * It is a Host default, not a Core preference: `--model` replaces it outright.- */-const defaultPictureModel = "@hypit/gpt-image";--/** Options this command exposes, mapped onto the port names models declare for them. */-const optionPorts = {- aspectRatio: "--aspect-ratio",- resolution: "--resolution",-} as const;--export type VideoCliPictureRequest = {- readonly model?: string;- readonly prompt: string;- readonly aspectRatio?: string;- readonly resolution?: string;- readonly packageRoot: string;- readonly distributionPackageRoot?: string;-};--export type VideoCliPicture = {- readonly package: string;- readonly model: string;- readonly mediaType: string;- readonly bytes: Uint8Array;-};--function assert(condition: unknown, message: string): asserts condition {- if (!condition) throw new Error(message);-}--/**- * Read the exact image models one installed package declares. The package loader owns- * which physical bytes answer to the specifier; this only reads the inert declaration.- */-async function selectImageModel(- specifier: string,- packageRoot: string,- distributionPackageRoot?: string,-): Promise<ExactModelEndpoint> {- const loaded = await loadNodePackageSelection([specifier], packageRoot, {- ...(distributionPackageRoot === undefined ? {} : { fallbackRoots: [distributionPackageRoot] }),- });- const selected = loaded.find((item) => item.specifier === specifier);- assert(selected !== undefined, `installed package ${specifier} contributed nothing`);- const declared = exactModelsFromHostFacets(selected.contribution.hostFacets ?? []);- const images = declared.filter((item) => item.ports.result === "image");- const [endpoint] = images;- assert(endpoint !== undefined, declared.length === 0- ? `${specifier} declares no exact model`- : `${specifier} declares no exact image model; it offers ${declared.map((item) => item.ports.model).join(", ")}`);- return endpoint;-}--/**- * Fill every port the model requires. An option the author gave wins; everything else- * takes the model's own first declared value, so the cheapest, most neutral rendering- * is what an unqualified request buys.- */-function portValue(- port: GenerationPort,- request: VideoCliPictureRequest,- model: string,-): GenerationPortValue | undefined {- if (port.name === "prompt") return request.prompt;- const supplied = port.name === "aspectRatio" ? request.aspectRatio- : port.name === "resolution" ? request.resolution- : undefined;- if (supplied !== undefined) return supplied;- if (port.minItems === 0) return undefined;- const kind = port.value;- if (kind.kind === "enum") return kind.values[0]!;- if (kind.kind === "boolean") return true;- if (kind.kind === "number") return kind.minimum ?? 1;- throw new Error(`${model} requires ${port.name}, which hypit image cannot supply`);-}--function sealPictureRequest(endpoint: ExactModelEndpoint, request: VideoCliPictureRequest): CanonicalValue {- const table = endpoint.ports;- for (const [name, option] of Object.entries(optionPorts)) {- if (request[name as keyof typeof optionPorts] === undefined) continue;- assert(table.ports.some((port) => port.name === name),- `${table.model} has no ${name}; remove ${option}`);- }- const ports = Object.fromEntries(table.ports.flatMap((port) => {- const value = portValue(port, request, table.model);- return value === undefined ? [] : [[port.name, [value]] as const];- }));- return sealGenerationPortRequest(table, ports) as unknown as CanonicalValue;-}--/**- * Reveal only the secrets this exact Endpoint registration declares. A missing one names- * the environment variable to set rather than the Provider's internals.- */-async function resolveCredentials(- registration: EndpointRegistration,-): Promise<Readonly<Record<string, { readonly secret: string }>>> {- const resolved: Record<string, { readonly secret: string }> = {};- for (const [slot, ref] of Object.entries(registration.credentials ?? {})) {- let value = await new EnvironmentCredentialStore().resolve(ref);- if (ref.store === "os") {- if (process.platform === "darwin" || process.platform === "win32") {- value = await new OsCredentialStore().resolve(ref).catch(() => undefined);- }- value ??= await new EnvironmentCredentialStore().resolve({ store: "env", key: "HYPIHUB_API_KEY" });- }- assert(value !== undefined, ref.key === "HYPIHUB_API_KEY"- ? `credential ${slot} is unavailable; sign in with HypiHub using: hypit auth login hypihub.default`- : ref.store === "env"- ? `credential ${slot} is unavailable; set ${ref.key} in the environment`- : `credential ${slot} lives in CredentialStore ${ref.store}, which hypit image cannot open`);- resolved[slot] = value;- }- return resolved;-}--function delay(milliseconds: number): Promise<void> {- return new Promise((resolve) => setTimeout(resolve, milliseconds));-}--/** Read the single picture out of the completed generation, then out of the Store. */-async function readPicture(- outcome: Extract<EndpointOutcome, { readonly status: "completed" }>,- resources: MemoryResourceStore,-): Promise<{ readonly bytes: Uint8Array; readonly mediaType: string }> {- const value = outcome.result.value;- assert(value.kind === "inline", "the model returned no inline image set");- verifyGeneratedImageSet(value.value);- const [image] = (value.value as unknown as { readonly images: readonly BlobRef[] }).images;- assert(image !== undefined, "the model returned no picture");- const bytes = await resources.get(image.resource);- assert(bytes !== undefined, `generated Artifact ${image.resource} was not stored`);- return { bytes, mediaType: image.mediaType };-}--/**- * Generate one picture with no Core graph.- *- * A package asset is authoring input, so nothing here is durable: the Need, the- * ResourceStore and the Provider all live for the length of this one call, and no- * Build, Record or Runtime Profile observes any of it.- */-export async function generateVideoCliPicture(request: VideoCliPictureRequest): Promise<VideoCliPicture> {- const specifier = request.model ?? defaultPictureModel;- const model = await selectImageModel(specifier, request.packageRoot, request.distributionPackageRoot);- const need: Need = {- id: "need:hypit-image",- capability: model.capability,- returns: model.returns,- constraints: sealPictureRequest(model, request),- result: "record:hypit-image",- };- const registry = new EndpointRegistry();- await createHypiHubProvider({}).install(registry);- const resolution = registry.resolve(need);- assert(resolution.status === "resolved",- `no Provider in this Distribution fulfils ${model.ports.model}`);- const registration = resolution.registration;- assert(registration.kind === "asynchronous",- `${model.ports.model} is fulfilled by an Endpoint hypit image cannot drive`);- const resources = new MemoryResourceStore();- const common = {- command: { kind: "fulfill-need" as const, id: "command:hypit-image", need },- need,- resources,- credentials: await resolveCredentials(registration),- operation: "operation:hypit-image",- };- let outcome = await registration.endpoint.start(common);- while (outcome.status === "pending") {- const waitMs = outcome.wakeAt === undefined ? 0 : outcome.wakeAt - Date.now();- if (waitMs > 0) await delay(waitMs);- outcome = await registration.endpoint.poll({ ...common, handle: outcome.handle });- }- assert(outcome.status === "completed", outcome.status === "failed"- ? `${model.ports.model} failed: ${outcome.failure.code} — ${outcome.failure.message}`- : `${model.ports.model} returned no picture`);- const picture = await readPicture(outcome, resources);- return {- package: specifier,- model: model.ports.model,- mediaType: picture.mediaType,- bytes: picture.bytes,- };-}diff --git a/packages/video-cli/test/cli.test.ts b/packages/video-cli/test/cli.test.tsindex 227d5827..d455bfc2 100644--- a/packages/video-cli/test/cli.test.ts+++ b/packages/video-cli/test/cli.test.ts@@ -1,5 +1,5 @@import assert from "node:assert/strict";-import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";+import { mkdtemp, rm, writeFile } from "node:fs/promises";import { tmpdir } from "node:os";import { join } from "node:path";import test from "node:test";@@ -60,72 +60,3 @@ test("provider-free example plans from installed Source packages", async () => {assert.equal(plan.steps > 0, true);assert.equal(plan.targets.length, 1);});--/**- * The command a package author uses for the package's own chrome. Every wire call is- * answered locally: this test spends nothing and reaches no network.- */-test("image writes one picture file with no Source, Build, Record or Runtime Profile", async () => {- const root = await mkdtemp(join(tmpdir(), "hypit-cli-image-"));- const pictureBytes = Uint8Array.from([137, 80, 78, 71, 13, 10, 26, 10]);- const calls: string[] = [];- const requests: Record<string, unknown>[] = [];- const realFetch = globalThis.fetch;- const realKey = process.env.HYPIHUB_API_KEY;- globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {- const url = String(input);- calls.push(url);- if (url.endsWith("/v1/models/gpt-image-2-text-to-image")) {- assert.equal((init?.headers as Record<string, string>).authorization, "Bearer test-image-key");- return Response.json({ id: "gpt-image-2-text-to-image", endpoints: ["images"] });- }- if (url.endsWith("/v1/images/generations")) {- assert.equal((init?.headers as Record<string, string>).authorization, "Bearer test-image-key");- requests.push(JSON.parse(String(init?.body)) as Record<string, unknown>);- return Response.json({ id: "job_image_test", status: "queued" }, { status: 202 });- }- if (url.endsWith("/v1/jobs/job_image_test")) {- return Response.json({ id: "job_image_test", status: "succeeded" });- }- if (url.endsWith("/v1/jobs/job_image_test/assets")) {- return Response.json({ items: [{ url: "https://download.hypihub.test/paper.png" }] });- }- if (url === "https://download.hypihub.test/paper.png") {- return new Response(pictureBytes, { status: 200, headers: { "content-type": "image/png" } });- }- throw new Error(`Unexpected URL ${url}`);- }) as typeof globalThis.fetch;- process.env.HYPIHUB_API_KEY = "test-image-key";- try {- const promptFile = join(root, "paper.txt");- await writeFile(promptFile, "A sheet of warm cream laid paper, even lighting, no text.\n", "utf8");- const destination = join(root, "assets", "paper.png");- let output = "";- await runCli([- "image", "--prompt", promptFile, "--to", destination, "--aspect-ratio", "1:1",- ], { write: (text) => { output += text; } });- const machine = JSON.parse(output) as {- readonly package: string; readonly model: string;- readonly mediaType: string; readonly bytes: number; readonly path: string;- };- assert.equal(machine.package, "@hypit/gpt-image");- assert.equal(machine.model, "gpt-image-2");- assert.equal(machine.mediaType, "image/png");- assert.equal(machine.bytes, pictureBytes.byteLength);- assert.equal(machine.path, destination);- assert.deepEqual(Uint8Array.from(await readFile(destination)), pictureBytes);- // The author gave one option; every other port took the model's own first value.- assert.deepEqual(requests, [{- model: "gpt-image-2-text-to-image",- prompt: "A sheet of warm cream laid paper, even lighting, no text.",- aspect_ratio: "1:1",- size: "1024x1024",- }]);- assert.equal(calls.filter((item) => item.endsWith("/v1/images/generations")).length, 1);- } finally {- globalThis.fetch = realFetch;- if (realKey === undefined) delete process.env.HYPIHUB_API_KEY;- else process.env.HYPIHUB_API_KEY = realKey;- await rm(root, { recursive: true, force: true });- }-});diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex f1c9505d..9d2937ae 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -3391,33 +3391,15 @@ importers:'@hypit/compiler-markup-node':specifier: workspace:*version: link:../compiler-markup-node- '@hypit/credential-store-env':- specifier: workspace:*- version: link:../credential-store-env'@hypit/credential-store-os':specifier: workspace:*version: link:../credential-store-os- '@hypit/driver-node':- specifier: workspace:*- version: link:../driver-node- '@hypit/endpoint-kit':- specifier: workspace:*- version: link:../endpoint-kit- '@hypit/generation':- specifier: workspace:*- version: link:../generation'@hypit/markup':specifier: workspace:*version: link:../markup- '@hypit/model-kit':- specifier: workspace:*- version: link:../model-kit'@hypit/package-loader-node':specifier: workspace:*version: link:../package-loader-node- '@hypit/protocol':- specifier: workspace:*- version: link:../protocol'@hypit/provider-hypihub':specifier: workspace:*version: link:../provider-hypihubdiff --git a/skills/hypit/references/element-review.md b/skills/hypit/references/element-review.mdindex 75ad73e5..5787060a 100644--- a/skills/hypit/references/element-review.md+++ b/skills/hypit/references/element-review.md@@ -78,8 +78,8 @@ can be illegible on the picture that will replace it.`render_element` delegates this to `@hypit/preview-mock`. The realizer finds every relevant logicaloutput in the compiled Author/Run Graph — the takes, stills and slot contents — derives geometry fromGraph inputs, and materializes them through `@hypit/mock-media` in a temporary Run under-`.hypit/preview/<run-name>/`. Never `hypit image`, which pays for a generation-the video will not reuse, and never a placeholder drawn by a script written for the occasion.+`.hypit/preview/<run-name>/`. Never a paid generation the video will not reuse, and never a+placeholder drawn by a script written for the occasion.Geometry follows the fixed Graph policy: Canvas width/height first, then generation aspect-ratio,then Canvas fallback; resolution labels such as `720p` and `2K` are not converted to pixels, anddiff --git a/skills/hypit/references/playbooks/craft/graphic-compositions.md b/skills/hypit/references/playbooks/craft/graphic-compositions.mdindex a689bad2..aada0bc0 100644--- a/skills/hypit/references/playbooks/craft/graphic-compositions.md+++ b/skills/hypit/references/playbooks/craft/graphic-compositions.md@@ -100,25 +100,22 @@ The test is one question: **would two different videos using this component showthere?** If yes, it belongs to the package. If they would show different pictures, it is an edge thesource supplies.-The two are also *obtained* differently, and this is where the line is most often crossed. The-component's surface is generated once while the package is authored, with `hypit image`, and-committed inside the package — it is authoring input. Source-supplied material is **declared in the-Source as a generation** — `<gpt:Image prompt={…}/>` fed by a `copy:Value` that holds its-description — so the picture and the words that produce it live together and can be reread,-corrected and rebuilt. Generating that material yourself and pointing `media:Image src=` at the file-throws the description away and leaves a picture nobody can regenerate; `media:Image` is for material-the author already had.--Never make a component's own surface a required input. A component whose chrome arrives from the-graph cannot render on its own, cannot produce the preview image its Surface owes, and forces every-project that installs it to obtain a picture that was never theirs to choose. If you find yourself-writing a Run Source whose only purpose is to produce a component's own texture, the texture is in-the wrong place: generate it once while authoring the package and commit the file.--Produce that file with `hypit image --prompt <text> --to <path>`, a direct billed HypiHub image-model-call (default `@hypit/gpt-image`, using HypiHub OAuth via `hypit auth login` at [hypit.ai](https://hypit.ai)). It writes a picture and nothing else; no-project Runtime Profile, Source, Run, Build or Record participates. A package asset is authoring-input, not the output of anybody's video, so it is never a Target or Record.+The two are also *obtained* differently, and this is where the line is most often crossed. A+component draws its own chrome in code: its Surface, Producer and Fragment render the paper, board,+panel or backdrop, and the preview image its Surface owes is captured from that rendering.+Source-supplied material is **declared in the Source as a generation** — `<gpt:Image prompt={…}/>`+fed by a `copy:Value` that holds its description — so the picture and the words that produce it live+together and can be reread, corrected, planned and rebuilt through `hypit plan` and `hypit build`.+Generating that material yourself and pointing `media:Image src=` at the file throws the description+away and leaves a picture nobody can regenerate; `media:Image` is for material the author already had.++Never make a component's own surface a required input, and never make it a generated raster either.+A component whose chrome arrives from the graph cannot render on its own, cannot produce the preview+image its Surface owes, and forces every project that installs it to obtain a picture that was never+theirs to choose. A component whose chrome is an image-model texture committed into the package+cannot be adjusted, themed or regenerated by anyone who did not run that generation. If you find+yourself writing a Run Source whose only purpose is to produce a component's own texture, or reaching+for an image model to make one, the chrome is in the wrong place: draw it in the component.A package is installed vocabulary. `.svml`, `.svs` and `.svrun` are documents that use it. A packagethat needs one of those documents in order to draw itself has inverted that relationship.