diff --git a/.changeset/light-birds-admire.md b/.changeset/light-birds-admire.md new file mode 100644 index 00000000000..bc6cdb620aa --- /dev/null +++ b/.changeset/light-birds-admire.md @@ -0,0 +1,5 @@ +--- +"kilo-code": minor +--- + +send x-kilocode-mode header diff --git a/src/api/providers/__tests__/kilocode-openrouter.spec.ts b/src/api/providers/__tests__/kilocode-openrouter.spec.ts index 5418b0b7d1e..36e7bddf7aa 100644 --- a/src/api/providers/__tests__/kilocode-openrouter.spec.ts +++ b/src/api/providers/__tests__/kilocode-openrouter.spec.ts @@ -22,6 +22,7 @@ import { X_KILOCODE_ORGANIZATIONID, X_KILOCODE_PROJECTID, X_KILOCODE_EDITORNAME, + X_KILOCODE_MODE, } from "../../../shared/kilocode/headers" import { streamSse } from "../../../services/continuedev/core/fetch/stream" @@ -81,6 +82,7 @@ describe("KilocodeOpenrouterHandler", () => { expect(result).toEqual({ headers: { + [X_KILOCODE_MODE]: "code", [X_KILOCODE_TASKID]: "test-task-id", [X_KILOCODE_EDITORNAME]: "Visual Studio Code 1.85.0", }, @@ -96,6 +98,7 @@ describe("KilocodeOpenrouterHandler", () => { expect(result).toEqual({ headers: { + [X_KILOCODE_MODE]: "code", [X_KILOCODE_TASKID]: "test-task-id", [X_KILOCODE_ORGANIZATIONID]: "test-org-id", [X_KILOCODE_EDITORNAME]: "Visual Studio Code 1.85.0", @@ -116,6 +119,7 @@ describe("KilocodeOpenrouterHandler", () => { expect(result).toEqual({ headers: { + [X_KILOCODE_MODE]: "code", [X_KILOCODE_TASKID]: "test-task-id", [X_KILOCODE_ORGANIZATIONID]: "test-org-id", [X_KILOCODE_PROJECTID]: "https://github.com/user/repo.git", @@ -137,6 +141,7 @@ describe("KilocodeOpenrouterHandler", () => { expect(result).toEqual({ headers: { + [X_KILOCODE_MODE]: "code", [X_KILOCODE_TASKID]: "test-task-id", [X_KILOCODE_PROJECTID]: "https://github.com/user/repo.git", [X_KILOCODE_ORGANIZATIONID]: "test-org-id", @@ -154,6 +159,7 @@ describe("KilocodeOpenrouterHandler", () => { expect(result).toEqual({ headers: { + [X_KILOCODE_MODE]: "code", [X_KILOCODE_TASKID]: "test-task-id", [X_KILOCODE_ORGANIZATIONID]: "test-org-id", [X_KILOCODE_EDITORNAME]: "Visual Studio Code 1.85.0", @@ -172,6 +178,7 @@ describe("KilocodeOpenrouterHandler", () => { expect(result).toEqual({ headers: { + [X_KILOCODE_MODE]: "code", [X_KILOCODE_TASKID]: "test-task-id", [X_KILOCODE_EDITORNAME]: "Visual Studio Code 1.85.0", }, @@ -229,6 +236,7 @@ describe("KilocodeOpenrouterHandler", () => { // kilocode_change start expect.objectContaining({ headers: expect.objectContaining({ + [X_KILOCODE_MODE]: "code", [X_KILOCODE_TASKID]: "test-task-id", [X_KILOCODE_PROJECTID]: "https://github.com/user/repo.git", [X_KILOCODE_ORGANIZATIONID]: "test-org-id", diff --git a/src/api/providers/kilocode-openrouter.ts b/src/api/providers/kilocode-openrouter.ts index 6128465124b..28d3bd68f76 100644 --- a/src/api/providers/kilocode-openrouter.ts +++ b/src/api/providers/kilocode-openrouter.ts @@ -13,6 +13,7 @@ import { X_KILOCODE_ORGANIZATIONID, X_KILOCODE_TASKID, X_KILOCODE_PROJECTID, + X_KILOCODE_MODE, X_KILOCODE_TESTER, X_KILOCODE_EDITORNAME, } from "../../shared/kilocode/headers" @@ -59,6 +60,10 @@ export class KilocodeOpenrouterHandler extends OpenRouterHandler { [X_KILOCODE_EDITORNAME]: getEditorNameHeader(), } + if (metadata?.mode) { + headers[X_KILOCODE_MODE] = metadata.mode + } + if (metadata?.taskId) { headers[X_KILOCODE_TASKID] = metadata.taskId } diff --git a/src/shared/kilocode/headers.ts b/src/shared/kilocode/headers.ts index 080606622a8..a876f2260ef 100644 --- a/src/shared/kilocode/headers.ts +++ b/src/shared/kilocode/headers.ts @@ -3,4 +3,5 @@ export const X_KILOCODE_ORGANIZATIONID = "X-KiloCode-OrganizationId" export const X_KILOCODE_TASKID = "X-KiloCode-TaskId" export const X_KILOCODE_PROJECTID = "X-KiloCode-ProjectId" export const X_KILOCODE_EDITORNAME = "X-KiloCode-EditorName" +export const X_KILOCODE_MODE = "X-KiloCode-Mode" export const X_KILOCODE_TESTER = "X-KILOCODE-TESTER"