Skip to content

Commit e9abdd1

Browse files
committed
Flip the fn params
1 parent 5622f00 commit e9abdd1

File tree

16 files changed

+98
-208
lines changed

16 files changed

+98
-208
lines changed

src/activate/registerCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { CodeIndexManager } from "../services/code-index/manager"
1616
import { importSettingsWithFeedback } from "../core/config/importExport"
1717
import { MdmService } from "../services/mdm/MdmService"
1818
import { t } from "../i18n"
19+
import { getKiloUrl } from "../shared/kilocode/url" // kilocode_change
1920
import { generateTerminalCommand } from "../utils/terminalCommandGenerator" // kilocode_change
20-
import { getKiloUrl } from "../shared/kilocode/url"
2121

2222
/**
2323
* Helper to get the visible ClineProvider instance or log if not found.

src/api/providers/fetchers/modelCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const getModels = async (options: GetModelsOptions): Promise<ModelRecord>
9898
const backendUrl = options.kilocodeOrganizationId
9999
? `https://api.kilocode.ai/api/organizations/${options.kilocodeOrganizationId}`
100100
: "https://api.kilocode.ai/api/openrouter"
101-
const openRouterBaseUrl = getKiloUrlFromToken(options.kilocodeToken ?? "", backendUrl)
101+
const openRouterBaseUrl = getKiloUrlFromToken(backendUrl, options.kilocodeToken ?? "")
102102
models = await getOpenRouterModels({
103103
openRouterBaseUrl,
104104
headers: options.kilocodeToken ? { Authorization: `Bearer ${options.kilocodeToken}` } : undefined,

src/api/providers/kilocode-openrouter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export class KilocodeOpenrouterHandler extends OpenRouterHandler {
3030
options = {
3131
...options,
3232
openRouterBaseUrl: getKiloUrlFromToken(
33-
options.kilocodeToken ?? "",
3433
"https://api.kilocode.ai/api/openrouter/",
34+
options.kilocodeToken ?? "",
3535
),
3636
openRouterApiKey: options.kilocodeToken,
3737
}

src/api/providers/kilocode/getKilocodeDefaultModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async function fetchKilocodeDefaultModel(
2424
): Promise<string> {
2525
try {
2626
const path = organizationId ? `/organizations/${organizationId}/defaults` : `/defaults`
27-
const url = getKiloUrlFromToken(kilocodeToken, `https://api.kilocode.ai/api${path}`)
27+
const url = getKiloUrlFromToken(`https://api.kilocode.ai/api${path}`, kilocodeToken)
2828

2929
const headers: Record<string, string> = {
3030
...DEFAULT_HEADERS,

src/core/config/CustomModesManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,8 +1069,8 @@ export class CustomModesManager {
10691069
}
10701070

10711071
const url = getKiloUrlFromToken(
1072-
kilocodeToken,
10731072
`https://api.kilocode.ai/api/organizations/${organizationId}/modes`,
1073+
kilocodeToken,
10741074
)
10751075
const response = await axios.get(url, { headers })
10761076

src/core/kilocode/webview/webviewMessageHandlerUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const fetchKilocodeNotificationsHandler = async (provider: ClineProvider)
9595
headers["X-KILOCODE-TESTER"] = "SUPPRESS"
9696
}
9797

98-
const url = getKiloUrlFromToken(kilocodeToken, "https://api.kilocode.ai/api/users/notifications")
98+
const url = getKiloUrlFromToken("https://api.kilocode.ai/api/users/notifications", kilocodeToken)
9999
const response = await axios.get(url, {
100100
headers,
101101
timeout: 5000,

src/core/tools/editFileTool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ function getFastApplyConfiguration(state: ClineProviderState): FastApplyConfigur
360360
if (!token) {
361361
return { available: false, error: "No KiloCode token available to use Fast Apply" }
362362
}
363-
const url = getKiloUrlFromToken(token, "https://api.kilocode.ai/api/openrouter/")
363+
const url = getKiloUrlFromToken("https://api.kilocode.ai/api/openrouter/", token)
364364

365365
return {
366366
available: true,

src/core/webview/ClineProvider.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ import { stringifyError } from "../../shared/kilocode/errorUtils"
106106
import isWsl from "is-wsl"
107107
import { getKilocodeDefaultModel } from "../../api/providers/kilocode/getKilocodeDefaultModel"
108108
import { getKiloCodeWrapperProperties } from "../../core/kilocode/wrapper"
109-
import { getKiloBaseUriFromToken } from "@roo-code/types"
110-
import { getKilocodeConfig, getWorkspaceProjectId, KilocodeConfig } from "../../utils/kilo-config-file" // kilocode_change
109+
import { getKiloUrlFromToken } from "../../shared/kilocode/token" // kilocode_change
110+
import { getKilocodeConfig, KilocodeConfig } from "../../utils/kilo-config-file" // kilocode_change
111111

112112
export type ClineProviderState = Awaited<ReturnType<ClineProvider["getState"]>>
113113
// kilocode_change end
@@ -3360,9 +3360,7 @@ Here is the project's README to help you get started:\n\n${mcpDetails.readmeCont
33603360
return result
33613361
}
33623362

3363-
const baseUrl = getKiloBaseUriFromToken(kilocodeToken)
3364-
const url = `${baseUrl}/api/profile/balance`
3365-
3363+
const url = getKiloUrlFromToken(`https://api.kilocode.ai/api/profile/balance`, kilocodeToken)
33663364
this.log(`[fetchBalanceData] Fetching balance from: ${url}`)
33673365

33683366
const response = await axios.get(url, {

src/core/webview/webviewMessageHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,7 +2595,7 @@ export const webviewMessageHandler = async (
25952595
headers["X-KILOCODE-TESTER"] = "SUPPRESS"
25962596
}
25972597

2598-
const url = getKiloUrlFromToken(kilocodeToken, "https://api.kilocode.ai/api/profile")
2598+
const url = getKiloUrlFromToken("https://api.kilocode.ai/api/profile", kilocodeToken)
25992599
const response = await axios.get<Omit<ProfileData, "kilocodeToken">>(url, { headers })
26002600

26012601
// Go back to Personal when no longer part of the current set organization
@@ -2691,7 +2691,7 @@ export const webviewMessageHandler = async (
26912691
headers["X-KILOCODE-TESTER"] = "SUPPRESS"
26922692
}
26932693

2694-
const url = getKiloUrlFromToken(kilocodeToken, "https://api.kilocode.ai/api/profile/balance")
2694+
const url = getKiloUrlFromToken("https://api.kilocode.ai/api/profile/balance", kilocodeToken)
26952695
const response = await axios.get(url, { headers })
26962696
provider.postMessageToWebview({
26972697
type: "balanceDataResponse", // New response type
@@ -2721,8 +2721,8 @@ export const webviewMessageHandler = async (
27212721
const source = uiKind === "Web" ? "web" : uriScheme
27222722

27232723
const url = getKiloUrlFromToken(
2724-
kilocodeToken,
27252724
`https://api.kilocode.ai/payments/topup?origin=extension&source=${source}&amount=${credits}`,
2725+
kilocodeToken,
27262726
)
27272727
const response = await axios.post(
27282728
url,

src/services/marketplace/RemoteConfigLoader.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from "axios"
22
import * as yaml from "yaml"
33
import { z } from "zod"
4-
import { getKiloBaseUriFromToken } from "@roo-code/types" // kilocode_change
4+
import { getKiloUrl } from "../../shared/kilocode/url"
55
import {
66
type MarketplaceItem,
77
type MarketplaceItemType,
@@ -19,13 +19,10 @@ const mcpMarketplaceResponse = z.object({
1919
})
2020

2121
export class RemoteConfigLoader {
22-
private apiBaseUrl: string
2322
private cache: Map<string, { data: MarketplaceItem[]; timestamp: number }> = new Map()
2423
private cacheDuration = 5 * 60 * 1000 // 5 minutes
2524

26-
constructor() {
27-
this.apiBaseUrl = getKiloBaseUriFromToken()
28-
}
25+
constructor() {}
2926

3027
async loadAllItems(hideMarketplaceMcps = false): Promise<MarketplaceItem[]> {
3128
const items: MarketplaceItem[] = []
@@ -47,7 +44,8 @@ export class RemoteConfigLoader {
4744
return cached
4845
}
4946

50-
const data = await this.fetchWithRetry<string>(`${this.apiBaseUrl}/api/marketplace/modes`)
47+
const url = getKiloUrl("https://kilocode.ai/api/marketplace/modes")
48+
const data = await this.fetchWithRetry<string>(url)
5149

5250
const yamlData = yaml.parse(data)
5351
const validated = modeMarketplaceResponse.parse(yamlData)
@@ -69,7 +67,8 @@ export class RemoteConfigLoader {
6967
return cached
7068
}
7169

72-
const data = await this.fetchWithRetry<string>(`${this.apiBaseUrl}/api/marketplace/mcps`)
70+
const url = getKiloUrl("https://kilocode.ai/api/marketplace/mcps")
71+
const data = await this.fetchWithRetry<string>(url)
7372

7473
const yamlData = yaml.parse(data)
7574
const validated = mcpMarketplaceResponse.parse(yamlData)

0 commit comments

Comments
 (0)