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.

994 B
Raw Blame
import type { RuntimeActionExecutor } from "@hypit/hypit/runtime";
import type { BuildExecutionStore } from "./execution.js";

/** All short Endpoint actions use the Runtime's existing shared resource authority. */
export function createActionExecutor(store: BuildExecutionStore): RuntimeActionExecutor {
  return {
    async run(request, execute) {
      const command = `action:${JSON.stringify([request.command, request.action])}`;
      const acquired = await store.acquireCapacity({
        build: request.build, command, lifetime: "action", resources: request.resources, now: Date.now(),
      });
      if (acquired.status === "blocked") return {
        status: "deferred",
        ...(acquired.availableAt === undefined ? {} : { wakeAt: acquired.availableAt }),
        reason: `${acquired.reason}:${acquired.resource}`,
      };
      try { return { status: "completed", value: await execute() }; }
      finally { await store.releaseCapacity(request.build, command); }
    },
  };
}