Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/kilo-gateway/src/api/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const HEADER_TASKID = "X-KILOCODE-TASKID"
export const HEADER_PROJECTID = "X-KILOCODE-PROJECTID"
export const HEADER_TESTER = "X-KILOCODE-TESTER"
export const HEADER_EDITORNAME = "X-KILOCODE-EDITORNAME"
export const HEADER_MACHINEID = "X-KILOCODE-MACHINEID"

/** Default editor name value */
export const DEFAULT_EDITOR_NAME = "Kilo CLI"
Expand Down
7 changes: 0 additions & 7 deletions packages/kilo-gateway/src/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
HEADER_PROJECTID,
HEADER_TESTER,
HEADER_EDITORNAME,
HEADER_MACHINEID,
USER_AGENT,
CONTENT_TYPE,
DEFAULT_EDITOR_NAME,
Expand All @@ -21,7 +20,6 @@ export const X_KILOCODE_TASKID = HEADER_TASKID
export const X_KILOCODE_PROJECTID = HEADER_PROJECTID
export const X_KILOCODE_TESTER = HEADER_TESTER
export const X_KILOCODE_EDITORNAME = HEADER_EDITORNAME
export const X_KILOCODE_MACHINEID = HEADER_MACHINEID

/**
* Default headers for KiloCode requests
Expand All @@ -47,7 +45,6 @@ export function buildKiloHeaders(
options?: {
kilocodeOrganizationId?: string
kilocodeTesterWarningsDisabledUntil?: number
machineId?: string
},
): Record<string, string> {
const headers: Record<string, string> = {
Expand All @@ -71,9 +68,5 @@ export function buildKiloHeaders(
headers[X_KILOCODE_TESTER] = TESTER_SUPPRESS_VALUE
}

if (options?.machineId) {
headers[X_KILOCODE_MACHINEID] = options.machineId
}

return headers
}
1 change: 0 additions & 1 deletion packages/kilo-gateway/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export {
HEADER_PROJECTID,
HEADER_TESTER,
HEADER_EDITORNAME,
HEADER_MACHINEID,
DEFAULT_EDITOR_NAME,
ENV_EDITOR_NAME,
TESTER_SUPPRESS_VALUE,
Expand Down
17 changes: 8 additions & 9 deletions packages/opencode/src/session/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import { DEFAULT_HEADERS } from "@/kilocode/const" // kilocode_change
import { Telemetry } from "@kilocode/kilo-telemetry" // kilocode_change
// kilocode_change start
import { getKiloProjectId } from "@/kilocode/project-id"
import { HEADER_PROJECTID, HEADER_MACHINEID } from "@kilocode/kilo-gateway"
import { Identity } from "@kilocode/kilo-telemetry"
import { HEADER_PROJECTID } from "@kilocode/kilo-gateway"
// kilocode_change end

export namespace LLM {
Expand Down Expand Up @@ -159,10 +158,9 @@ export namespace LLM {
},
)

// kilocode_change start - resolve project ID and machine ID for kilo provider
const isKilo = input.model.api.npm === "@kilocode/kilo-gateway"
const kiloProjectId = isKilo ? await getKiloProjectId().catch(() => undefined) : undefined
const machineId = isKilo ? await Identity.getMachineId().catch(() => undefined) : undefined
// kilocode_change start - resolve project ID for kilo provider
const kiloProjectId =
input.model.api.npm === "@kilocode/kilo-gateway" ? await getKiloProjectId().catch(() => undefined) : undefined
// kilocode_change end

const maxOutputTokens =
Expand Down Expand Up @@ -239,9 +237,10 @@ export namespace LLM {
...(input.model.api.npm === "@kilocode/kilo-gateway" && input.agent.name
? { "x-kilocode-mode": input.agent.name.toLowerCase() }
: {}),
// kilocode_change start - add project ID and machine ID headers for kilo provider
...(isKilo && kiloProjectId ? { [HEADER_PROJECTID]: kiloProjectId } : {}),
...(isKilo && machineId ? { [HEADER_MACHINEID]: machineId } : {}),
// kilocode_change start - add project ID header for kilo provider
...(input.model.api.npm === "@kilocode/kilo-gateway" && kiloProjectId
? { [HEADER_PROJECTID]: kiloProjectId }
: {}),
// kilocode_change end
...input.model.headers,
...headers,
Expand Down
Loading