An agent skill for creating detailed, interactive isometric illustrations of real-world machines and complex systems. Generates polished SVGs with optional WebGL shaders and 3D effects.
import { rmSync } from "node:fs";
export async function chromePort(chrome, profile) {
try {
return await new Promise((done, fail) => {
let text = "";
const clean = () => {
clearTimeout(timer);
chrome.stderr.off("data", data);
chrome.off("error", error);
chrome.off("exit", exited);
};
const error = (cause) => {
clean();
fail(cause);
};
const exited = (code, signal) => error(new Error(`Chrome exited before startup: ${code ?? signal}`));
const data = (chunk) => {
text += chunk;
const match = text.match(/DevTools listening on ws:\/\/[^:]+:(\d+)\//);
if (match) {
clean();
done(Number(match[1]));
}
};
const timer = setTimeout(() => error(new Error("Chrome did not start")), 20000);
chrome.stderr.on("data", data);
chrome.on("error", error);
chrome.on("exit", exited);
});
} catch (error) {
chrome.kill("SIGKILL");
rmSync(profile, { recursive: true, force: true });
throw error;
}
}