comfyui-mcp
Version:
Local-first, agent-native control plane for ComfyUI — MCP server + autonomous sidebar agent that drives your live graph in natural language on ANY LLM: Claude/ChatGPT/Gemini on your subscription (no API key), free local models via Ollama (fully offline),
39 lines • 1.25 kB
JavaScript
import { Readable } from "node:stream";
export function safeErrorDetails(err) {
if (!err || typeof err !== "object")
return {};
const record = err;
const metadata = record.$metadata;
return {
name: typeof record.name === "string" ? record.name : undefined,
code: typeof record.Code === "string"
? record.Code
: typeof record.code === "string"
? record.code
: undefined,
status: metadata?.httpStatusCode,
};
}
export function bodyToReadable(body) {
if (body instanceof Readable)
return body;
if (body instanceof Uint8Array)
return Readable.from(body);
if (body && typeof body.transformToByteArray === "function") {
return Readable.from((async function* () {
yield await body
.transformToByteArray();
})());
}
return Readable.fromWeb(body);
}
export function normalizePrefix(prefix) {
if (!prefix)
return "";
return prefix.replace(/^\/+/, "").replace(/\/+$/, "");
}
export function withPrefix(prefix, filename) {
const clean = normalizePrefix(prefix);
return clean ? `${clean}/${filename}` : filename;
}
//# sourceMappingURL=utils.js.map