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.

811 B
Raw Blame
import {
  canonicalize,
} from "@hypit/protocol";
import type {
  Candidate,
  StoredValue,
  TypeRef,
} from "@hypit/protocol";

export type ProvidedCandidateInput = {
  readonly id: string;
  readonly type: TypeRef;
  readonly value: StoredValue;
  readonly record?: string;
};

export function createProvidedCandidate(input: ProvidedCandidateInput): Candidate {
  if (input.id.trim().length === 0) throw new Error("Provided Candidate id is empty");
  const value = input.value.kind === "inline"
    ? { kind: "inline" as const, value: canonicalize(input.value.value) }
    : { ...input.value };
  return {
    id: `candidate:run:${input.id}`,
    type: input.type,
    root: {
      kind: "value",
      value: {
        id: input.record ?? `provided:run:${input.id}`,
        value,
      },
    },
  };
}