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.

1.2 KB
Raw Blame
import type { Composition } from "@hypit/composition";
import type { Timeline } from "@hypit/timeline";
import type { ProducerPackage } from "@hypit/hypit/producer";
import type { AdmissionPackage } from "@hypit/hypit/admission";
import { canonicalize } from "@hypit/hypit/protocol";
import { compileHtmlDocument, assertHtmlDocument } from "./document.js";
import { htmlDocumentProducers, htmlDocumentTypes } from "./manifest.js";

export const htmlDocumentComponent = {
  producers: [{ producer: htmlDocumentProducers.compile, handler: ({ inputs }) => {
    const composition = inputs.composition!.value, timeline = inputs.timeline!.value;
    if (composition.kind !== "inline" || timeline.kind !== "inline") throw new Error("HTML document requires inline Composition and Timeline");
    return { outputs: { document: { kind: "inline", value: canonicalize(compileHtmlDocument(composition.value as unknown as Composition, timeline.value as unknown as Timeline)) } }, needs: {} };
  } }],
  validators: [{ type: htmlDocumentTypes.document, handler({ value }) {
    if (value.kind !== "inline") throw new Error("HTML document must be inline");
    assertHtmlDocument(value.value);
  } }],
} satisfies ProducerPackage & AdmissionPackage;