Public Beta
Not set

Experience

Changes how pages explain things, never what you can do.

More

Experience

Changes how pages explain things, never what you can do.

Sign inGet started

Video Production Assistant v0.2.2 · generic

Archive SHA-256 d38df1b9e9ea1c080d498fdf558574759ebb2e7999a19a5fc60e5a761282020e · 61.6 KB · built Dec 2, 2026

src/index.js

// AgentRove native agent: video-production (MIT).
// Tools: plan_production, export_captions and ffmpeg_commands are offline and side-effect free
// (ffmpeg_commands returns command TEXT only). render (src/run.js) is the one tool that executes
// FFmpeg on local files; it requires confirm: true and runs only allowlisted, validated argv.
// This module never imports src/run.js (which starts processes): the Node.js entry points (bin/cli.js, bin/mcp.js) plug the
// runner in with useNodeRunner(), so the side-effect-free tools can also run in a browser (0.2.2).

import { readFileSync } from "node:fs";
import { defineAgent, makeContext, handleMcpMessage, runCli, runMcpStdio, validateManifest } from "../sdk/index.js";
import { ToolError } from "./errors.js";
import { planProduction } from "./plan.js";
import { buildCaptions } from "./captions.js";
import { OPTIONS, buildOperation, validateArgv, render as quoteCommand } from "./ffmpeg.js";
export { makeContext, handleMcpMessage, runCli, runMcpStdio, validateManifest, validateArgv };

let nodeRunner = null;
/** Plugs in the FFmpeg runner (src/run.js) for render. Called by the Node.js entry points, never by a browser build. */
export function useNodeRunner(runner) {
  nodeRunner = runner;
}

export const manifest = JSON.parse(readFileSync(new URL("../agent.json", import.meta.url), "utf8"));

async function plan_production(input) {
  return planProduction(input);
}

async function export_captions(input) {
  return buildCaptions(input.script, input);
}

async function ffmpeg_commands(input) {
  const shell = input.shell ?? "posix";
  const bin = input.ffmpeg_binary ?? "ffmpeg";
  if (bin.startsWith("-") || !/(^|[\\/])ffmpeg(\.exe)?$/i.test(bin)) throw new ToolError("invalid_input", "ffmpeg_binary must be ffmpeg or a path ending in ffmpeg / ffmpeg.exe.");
  const warnings = [];
  const outputs = new Map();
  const commands = input.operations.map((o, i) => {
    const { args, notes, files } = buildOperation(o, i);
    const argv = [bin, "-hide_banner", "-nostdin", input.overwrite ? "-y" : "-n", ...args, o.output];
    validateArgv(argv);
    if (outputs.has(o.output)) warnings.push(`operations[${i}] writes ${o.output}, which operations[${outputs.get(o.output)}] also writes.`);
    outputs.set(o.output, i);
    const cmd = { op: o.op, argv, command: quoteCommand(argv, shell), shell, notes };
    if (files.length) cmd.files = files;
    return cmd;
  });
  warnings.push("These commands were NOT run. Review them, then run them yourself in the folder that holds your media.");
  if (!input.overwrite) warnings.push("-n is set, so FFmpeg stops instead of overwriting an existing output file.");
  return { commands, executed: false, allowed_options: Object.keys(OPTIONS), warnings };
}

// Executes allowlisted FFmpeg operations on files inside the media folder (see src/run.js).
async function render(input) {
  if (!nodeRunner) throw new ToolError("not_available_on_platform", "render runs FFmpeg on local files, which needs the Node.js package: run it with bin/cli.js or bin/mcp.js.");
  return nodeRunner.runRender(input);
}

const agent = defineAgent(manifest, { plan_production, ffmpeg_commands, export_captions, render });
export default agent;

Find an agent

Do not include passwords, keys, customer data or other confidential details.
Rule-based matching is free during the public beta (fair use).