Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style(mock-api): reformat long lines for readability

Steven Enamakel332f8f5f2c62
diff --git a/scripts/mock-api/routes/__tests__/media.test.mjs b/scripts/mock-api/routes/__tests__/media.test.mjs
index 474963058f..387152e364 100644
--- a/scripts/mock-api/routes/__tests__/media.test.mjs
+++ b/scripts/mock-api/routes/__tests__/media.test.mjs
@@ -16,7 +16,9 @@ function createRes() {
this.headers[name] = value;
},
end(chunk = "") {
- this.body += Buffer.isBuffer(chunk) ? chunk.toString("latin1") : String(chunk);
+ this.body += Buffer.isBuffer(chunk)
+ ? chunk.toString("latin1")
+ : String(chunk);
},
};
}
@@ -24,13 +26,24 @@ function createRes() {
function call(method, url, parsedBody) {
const res = createRes();
const handled = handleMedia({ method, url, parsedBody, res });
- return { handled, res, body: res.headers["Content-Type"] === "video/mp4" ? null : JSON.parse(res.body || "null") };
+ return {
+ handled,
+ res,
+ body:
+ res.headers["Content-Type"] === "video/mp4"
+ ? null
+ : JSON.parse(res.body || "null"),
+ };
}
test.beforeEach(() => resetMediaMock());
test("images return an enveloped OpenRouter body with base64 images", () => {
- const { handled, res, body } = call("POST", "/agent-integrations/openrouter/images", { prompt: "x", n: 2 });
+ const { handled, res, body } = call(
+ "POST",
+ "/agent-integrations/openrouter/images",
+ { prompt: "x", n: 2 },
+ );
assert.equal(handled, true);
assert.equal(res.statusCode, 200);
assert.equal(body.success, true);
@@ -45,22 +58,35 @@ test("images reject a missing prompt", () => {
});
test("video jobs report completed-without-outputs before delivering", () => {
- const submit = call("POST", "/agent-integrations/openrouter/videos", { prompt: "x" });
+ const submit = call("POST", "/agent-integrations/openrouter/videos", {
+ prompt: "x",
+ });
const id = submit.body.data.id;
- const poll = () => call("GET", `/agent-integrations/openrouter/videos/${id}`).body.data;
+ const poll = () =>
+ call("GET", `/agent-integrations/openrouter/videos/${id}`).body.data;
assert.equal(poll().status, "in_progress");
const early = poll();
assert.equal(early.status, "completed");
- assert.deepEqual(early.unsigned_urls, [], "completed before the output exists");
+ assert.deepEqual(
+ early.unsigned_urls,
+ [],
+ "completed before the output exists",
+ );
const done = poll();
assert.equal(done.status, "completed");
assert.equal(done.unsigned_urls.length, 1);
- const content = call("GET", `/agent-integrations/openrouter/videos/${id}/content?index=0`);
+ const content = call(
+ "GET",
+ `/agent-integrations/openrouter/videos/${id}/content?index=0`,
+ );
assert.equal(content.res.headers["Content-Type"], "video/mp4");
});
test("unrelated routes fall through", () => {
- assert.equal(call("GET", "/agent-integrations/composio/tools").handled, false);
+ assert.equal(
+ call("GET", "/agent-integrations/composio/tools").handled,
+ false,
+ );
});
diff --git a/scripts/mock-api/routes/media.mjs b/scripts/mock-api/routes/media.mjs
index c3250677f4..72a1e56028 100644
--- a/scripts/mock-api/routes/media.mjs
+++ b/scripts/mock-api/routes/media.mjs
@@ -53,7 +53,10 @@ export function handleMedia(ctx) {
id: "bytedance-seed/seedream-5-0-lite",
display_name: "Seedream 5.0 Lite",
supported_parameters: {
- aspect_ratio: { type: "enum", values: ["1:1", "16:9", "9:16", "4:3", "3:4", "auto"] },
+ aspect_ratio: {
+ type: "enum",
+ values: ["1:1", "16:9", "9:16", "4:3", "3:4", "auto"],
+ },
n: { type: "range", min: 1, max: 4 },
input_references: { type: "range", min: 0, max: 14 },
seed: { type: "boolean" },
@@ -75,7 +78,10 @@ export function handleMedia(ctx) {
success: true,
data: {
created: Math.floor(Date.now() / 1000),
- data: Array.from({ length: n }, () => ({ b64_json: PNG_BASE64, media_type: "image/png" })),
+ data: Array.from({ length: n }, () => ({
+ b64_json: PNG_BASE64,
+ media_type: "image/png",
+ })),
usage: { cost: 0.035 * n },
},
});
@@ -114,14 +120,20 @@ export function handleMedia(ctx) {
const content = path.match(/^\/videos\/([^/]+)\/content$/);
if (method === "GET" && content) {
- res.writeHead(200, { "Content-Type": "video/mp4", "Content-Length": MP4_BYTES.length });
+ res.writeHead(200, {
+ "Content-Type": "video/mp4",
+ "Content-Length": MP4_BYTES.length,
+ });
res.end(MP4_BYTES);
return true;
}
const job = path.match(/^\/videos\/([^/]+)$/);
if (method === "GET" && job) {
- json(res, 200, { success: true, data: { id: job[1], ...jobStatus(job[1]) } });
+ json(res, 200, {
+ success: true,
+ data: { id: job[1], ...jobStatus(job[1]) },
+ });
return true;
}