merge: sync master into dev

Sync master into dev while preserving dev-specific feature logic and include the required co-author trailer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-07-23 11:52:27 +07:00
co-authored by Copilot
97 changed files with 6384 additions and 985 deletions
+26
View File
@@ -5,8 +5,34 @@ import { translateRequest } from "../../open-sse/translator/index.js";
import { FORMATS } from "../../open-sse/translator/formats.js";
const O2K = (body) => translateRequest(FORMATS.OPENAI, FORMATS.KIRO, "m", body, true, null, "kiro");
const R2K = (model, body) => translateRequest(
FORMATS.OPENAI_RESPONSES,
FORMATS.KIRO,
model,
body,
true,
null,
"kiro"
);
describe("OpenAI → Kiro", () => {
it.each([
["high", "gpt-5.6-sol"],
["medium", "gpt-5.6-terra"],
["low", "gpt-5.6-luna"],
])("preserves Responses reasoning.effort %s through the full Kiro route", (effort, model) => {
const out = R2K(model, {
input: "Use the requested effort",
reasoning: { effort },
});
expect(out.additionalModelRequestFields).toEqual({
reasoning: { effort },
});
expect(out.systemPrompt || "").not.toContain("<thinking_mode>");
expect(out.systemPrompt || "").not.toContain("<max_thinking_length>");
});
// openai-to-kiro.js — safeJSONParse guards bad tool-call JSON (fixed in PR #1582)
it("malformed tool arguments do not throw the whole request", () => {
expect(() =>
@@ -112,6 +112,59 @@ describe("Claude → Kiro (direct route)", () => {
expect(out.systemPrompt).toContain("<max_thinking_length>24576</max_thinking_length>");
});
it("maps Claude-format effort to GPT-5.6 reasoning fields without legacy prompt tags", () => {
const out = C2K({
output_config: { effort: "low" },
messages: [{ role: "user", content: "think lightly" }],
}, null, "gpt-5.6-sol");
expect(out.additionalModelRequestFields).toEqual({
reasoning: { effort: "low" },
});
expect(out.systemPrompt || "").not.toContain("<thinking_mode>");
expect(out.systemPrompt || "").not.toContain("<max_thinking_length>");
});
it.each(["auto", "minimal", "ultra"])(
"keeps the legacy thinking fallback for unsupported GPT-5.6 effort %s",
(effort) => {
const out = C2K({
output_config: { effort },
messages: [{ role: "user", content: "Use legacy thinking" }],
}, null, "gpt-5.6-sol");
expect(out.additionalModelRequestFields).toBeUndefined();
expect(out.systemPrompt).toContain("<thinking_mode>enabled</thinking_mode>");
expect(out.systemPrompt).toContain("<max_thinking_length>");
}
);
it.each(["none", "off", "disabled"])(
"keeps GPT-5.6 reasoning intentionally disabled for effort %s",
(effort) => {
const out = C2K({
output_config: { effort },
messages: [{ role: "user", content: "Do not reason" }],
}, null, "gpt-5.6-sol");
expect(out.additionalModelRequestFields).toBeUndefined();
expect(out.systemPrompt || "").not.toContain("<thinking_mode>");
expect(out.systemPrompt || "").not.toContain("<max_thinking_length>");
}
);
it("keeps explicit Claude effort ahead of an injected OpenAI effort", () => {
const out = C2K({
output_config: { effort: "low" },
reasoning_effort: "high",
messages: [{ role: "user", content: "honor the client effort" }],
}, null, "gpt-5.6-sol");
expect(out.additionalModelRequestFields).toEqual({
reasoning: { effort: "low" },
});
});
it("sends Claude system as top-level systemPrompt and keeps a user-content fallback", () => {
const out = C2K({
system: "system-only instruction",