mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-10-19 05:20:05 +00:00
Onda A 2026-10-07. Combined board e1b721a1 validated this PR together with the rest of the wave, then this squash lands the contributor head unchanged. - typecheck:core passed - complexity 2993 (baseline 3218) - cognitive complexity 1366 (baseline 1437) - changelog integrity passed - file-size passed after the authorized ceiling bump; that bump ships in the wave follow-up, not in this squash - focused tests: 318 passed in the batch run. The Devin anthropic price assertion already mismatches CLAUDE_SONNET_5_PRICING on origin/release/v3.8.52, and this wave does not change that constant. The combo-metadata miss did not reproduce when that file ran alone. fix(providers): route Muse Code OAuth requests to the Responses API Thanks @lorenzozanee. ⚠️ base-red inherited: #15306
65 lines
2 KiB
TypeScript
65 lines
2 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { DefaultExecutor } from "../../open-sse/executors/default.ts";
|
|
|
|
test("muse-code sends reminted Responses requests to its configured endpoint", async () => {
|
|
const originalFetch = globalThis.fetch;
|
|
const requests: { url: string; body: unknown }[] = [];
|
|
globalThis.fetch = async (input, init = {}) => {
|
|
requests.push({
|
|
url: String(input),
|
|
body: JSON.parse(String(init.body)),
|
|
});
|
|
return new Response(JSON.stringify({ id: "resp_test", object: "response", output: [] }), {
|
|
status: 200,
|
|
headers: { "Content-Type": "application/json" },
|
|
});
|
|
};
|
|
|
|
try {
|
|
await new DefaultExecutor("muse-code").execute({
|
|
model: "muse-spark-1.3",
|
|
body: {
|
|
model: "muse-spark-1.3",
|
|
input: "hello",
|
|
max_output_tokens: 20,
|
|
},
|
|
stream: false,
|
|
credentials: {
|
|
apiKey: "LLM|test",
|
|
providerSpecificData: { baseUrl: "https://api.meta.ai/v1" },
|
|
},
|
|
});
|
|
} finally {
|
|
globalThis.fetch = originalFetch;
|
|
}
|
|
|
|
assert.equal(requests.length, 1);
|
|
assert.equal(requests[0].url, "https://api.meta.ai/v1/responses");
|
|
assert.deepEqual(requests[0].body, {
|
|
model: "muse-spark-1.3",
|
|
input: "hello",
|
|
max_output_tokens: 20,
|
|
});
|
|
});
|
|
|
|
test("muse-code preserves a configured host while selecting the Responses endpoint", () => {
|
|
const executor = new DefaultExecutor("muse-code");
|
|
assert.equal(
|
|
executor.buildUrl("muse-spark-1.3", false, 0, {
|
|
providerSpecificData: { baseUrl: "https://proxy.example/v1" },
|
|
}),
|
|
"https://proxy.example/v1/responses"
|
|
);
|
|
});
|
|
|
|
test("unrelated OpenAI-compatible providers retain their chat endpoint", () => {
|
|
const executor = new DefaultExecutor("openai-compatible-test");
|
|
assert.equal(
|
|
executor.buildUrl("gpt-4.1", true, 0, {
|
|
providerSpecificData: { baseUrl: "https://proxy.example/v1" },
|
|
}),
|
|
"https://proxy.example/v1/chat/completions"
|
|
);
|
|
});
|