Merge branch 'master' into dev

# Conflicts:
#	src/app/(dashboard)/dashboard/cli-tools/[toolId]/ToolDetailClient.js
#	src/app/(dashboard)/dashboard/cli-tools/components/index.js
#	src/app/(dashboard)/dashboard/providers/[id]/AddApiKeyModal.js
#	src/app/api/cli-tools/all-statuses/route.js
#	src/app/api/settings/route.js
#	src/app/api/v1/models/route.js
#	src/shared/constants/cliTools.js
This commit is contained in:
2026-07-17 11:15:18 +07:00
85 changed files with 9230 additions and 669 deletions
@@ -118,6 +118,9 @@ exports[`GOLDEN request: OpenAI → Claude > reasoning_effort → adaptive outpu
"type": "text",
},
],
"thinking": {
"type": "adaptive",
},
}
`;
+68 -7
View File
@@ -6,8 +6,8 @@ import "./registerAll.js";
import { translateRequest, translateResponse } from "../../open-sse/translator/index.js";
import { FORMATS } from "../../open-sse/translator/formats.js";
const C2K = (body) =>
translateRequest(FORMATS.CLAUDE, FORMATS.KIRO, "claude-sonnet-4.5", body, true, null, "kiro");
const C2K = (body, credentials = null, model = "claude-sonnet-4.5") =>
translateRequest(FORMATS.CLAUDE, FORMATS.KIRO, model, body, true, credentials, "kiro");
describe("Claude → Kiro (direct route)", () => {
it("produces a Kiro conversationState payload", () => {
@@ -16,6 +16,27 @@ describe("Claude → Kiro (direct route)", () => {
expect(out.conversationState.currentMessage.userInputMessage.content).toContain("hello");
});
it("keeps conversationId stable from client session headers and replays frozen msg0", () => {
const credentials = {
rawHeaders: { "x-session-id": "hermes-session-123-claude-replay" },
connectionId: "kiro-account-1",
};
const first = C2K({ messages: [{ role: "user", content: "first" }] }, credentials);
const second = C2K({ messages: [{ role: "user", content: "second" }] }, credentials);
expect(first.conversationState.conversationId).toBe("hermes-session-123-claude-replay");
expect(second.conversationState.conversationId).toBe("hermes-session-123-claude-replay");
expect(first.conversationState.agentContinuationId).toBeTruthy();
expect(second.conversationState.agentContinuationId).toBe(first.conversationState.agentContinuationId);
expect(first.conversationState.agentTaskType).toBe("vibe");
expect(second.conversationState.history[0].userInputMessage.content).toBe(
first.conversationState.currentMessage.userInputMessage.content
);
expect(second.conversationState.history[0].userInputMessage.modelId).toBe("claude-sonnet-4.5");
expect(second.conversationState.currentMessage.userInputMessage.content).toContain("Current time");
expect(second.conversationState.currentMessage.userInputMessage.content).toContain("second");
});
it("guard 1: with no tools, a dangling tool_result is flattened to text (no structured ref)", () => {
// Client omitted `tools` but kept a tool_result after compaction.
const out = C2K({
@@ -60,20 +81,60 @@ describe("Claude → Kiro (direct route)", () => {
null,
"kiro"
);
expect(out.conversationState.currentMessage.userInputMessage.content).toContain(
expect(out.systemPrompt).toContain(
"<thinking_mode>enabled</thinking_mode>"
);
expect(out.agentMode).toBe("vibe");
});
it("maps output_config.effort high to Kiro max_thinking_length 24576", () => {
it("does not send additionalModelRequestFields for Kiro models without effort support", () => {
const out = C2K({
output_config: { effort: "high" },
messages: [{ role: "user", content: "think with adaptive effort" }],
});
expect(out.conversationState.currentMessage.userInputMessage.content).toContain(
"<max_thinking_length>24576</max_thinking_length>"
);
expect(out.additionalModelRequestFields).toBeUndefined();
expect(out.thinking).toBeUndefined();
expect(out.systemPrompt).toContain("<max_thinking_length>24576</max_thinking_length>");
});
it("maps output_config.effort high to Kiro CLI-style additionalModelRequestFields for effort models", () => {
const out = C2K({
output_config: { effort: "high" },
messages: [{ role: "user", content: "think with adaptive effort" }],
}, null, "claude-sonnet-5");
expect(out.additionalModelRequestFields).toEqual({
thinking: { type: "adaptive", display: "summarized" },
output_config: { effort: "high" },
});
expect(out.thinking).toBeUndefined();
expect(out.systemPrompt).toContain("<max_thinking_length>24576</max_thinking_length>");
});
it("sends Claude system as top-level systemPrompt and keeps a user-content fallback", () => {
const out = C2K({
system: "system-only instruction",
messages: [{ role: "user", content: "hello" }],
});
expect(out.systemPrompt).toContain("system-only instruction");
expect(out.conversationState.currentMessage.userInputMessage.content).toContain("system-only instruction");
});
it("keeps top-level systemPrompt stable across turns", () => {
const first = C2K({
system: "stable instruction",
messages: [{ role: "user", content: "first" }],
});
const second = C2K({
system: "stable instruction",
messages: [{ role: "user", content: "second" }],
});
expect(first.systemPrompt).toBe(second.systemPrompt);
expect(first.systemPrompt).not.toContain("Current time");
expect(first.conversationState.currentMessage.userInputMessage.content).toContain("Current time");
});
});
+6 -2
View File
@@ -55,10 +55,14 @@ describe("extractThinking", () => {
});
describe("applyThinking per provider format", () => {
it("claude 4.6+ → adaptive output_config (no budget_tokens)", () => {
it("claude 4.6+ → adaptive thinking + output_config (no budget_tokens)", () => {
const out = apply("claude", "claude-opus-4.7", { reasoning_effort: "high" }, "claude");
expect(out.output_config).toEqual({ effort: "high" });
expect(out.thinking).toBeUndefined();
// Anthropic: on Opus 4.6/4.7/4.8 and Sonnet 4.6 thinking stays OFF unless
// thinking:{type:"adaptive"} is sent explicitly; output_config alone is not
// enough (and Anthropic-compatible shims like Copilot default off even on
// Sonnet 5). Both fields together are the documented adaptive shape.
expect(out.thinking).toEqual({ type: "adaptive" });
});
it("claude haiku → enabled+budget", () => {
const out = apply("claude", "claude-haiku-4.5", { reasoning_effort: "high" }, "claude");