app
Premiere Pro Bridge
Public Made by Adomby adom
Let the AI edit video in Adobe Premiere Pro on your desktop (import, cut, trim, razor, effects, audio, previews, export) with no mouse or keyboard. Check adom-bridge bridge_list for 'premiere'; install with bridge_install + adom-wiki pkg install adom/premiere-bridge, then start with premiere_status.
main
anastasia
Premiere Pro Bridge 0.1.0: Rust bridge, UXP plugin, CEP helper, skills, macOS manifest
32fb583
10d ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
// Adom Bridge CEP helper — invisible; dials the Rust bridge's WebSocket and runs
// ExtendScript (host.jsx) for the verbs UXP can't do. Same protocol as the UXP plugin.
(function () {
"use strict";
var HELPER_VERSION = "0.1.0";
var nodeRequire = typeof require !== "undefined" ? require : window.cep_node && window.cep_node.require;
var fs = nodeRequire("fs");
var os = nodeRequire("os");
var path = nodeRequire("path");
var ws = null;
var backoff = 1000;
function evalScript(script) {
return new Promise(function (resolve) {
window.__adobe_cep__.evalScript(script, function (res) {
resolve(res);
});
});
}
function readConnection() {
try {
var p = path.join(os.homedir(), ".adom", "premiere-bridge", "connection.json");
var j = JSON.parse(fs.readFileSync(p, "utf8"));
return j && j.port && j.token ? j : null;
} catch (e) {
return null;
}
}
function send(obj) {
if (ws && ws.readyState === 1) ws.send(JSON.stringify(obj));
}
function connect() {
if (ws && ws.readyState <= 1) return;
var conn = readConnection();
if (!conn) return retry();
var sock = new WebSocket("ws://127.0.0.1:" + conn.port + "/ws?token=" + encodeURIComponent(conn.token));
ws = sock;
sock.onopen = function () {
backoff = 1000;
evalScript("adom_hello()").then(function (res) {
var info = {};
try {
info = JSON.parse(res);
} catch (e) {}
info.type = "hello";
info.runtime = "cep";
info.helperVersion = HELPER_VERSION;
info.protocol = 1;
send(info);
});
};
sock.onmessage = function (ev) {
var msg;
try {
msg = JSON.parse(ev.data);
} catch (e) {
return;
}
if (msg.type === "ping") return send({ type: "pong" });
if (msg.type !== "call") return;
var payload = JSON.stringify(JSON.stringify({ verb: msg.verb, args: msg.args || {} }));
evalScript("adom_dispatch(" + payload + ")").then(function (res) {
var out;
try {
out = JSON.parse(res);
} catch (e) {
out = { ok: false, error: "ExtendScript returned non-JSON: " + String(res).slice(0, 500), errorCode: "extendscript_error" };
}
out.type = "result";
out.id = msg.id;
send(out);
});
};
sock.onclose = function () {
if (ws === sock) ws = null;
retry();
};
}
function retry() {
setTimeout(connect, backoff);
backoff = Math.min(backoff * 2, 5000);
}
connect();
})();