mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-01 15:32:11 +08:00
refactor(core): keep provider usage internals private
This commit is contained in:
@@ -15,7 +15,7 @@ const successTtl = 60_000
|
||||
const errorTtl = 10_000
|
||||
const readyPlugin = PluginV2.ID.make("config-provider")
|
||||
|
||||
export interface AdapterContext {
|
||||
interface AdapterContext {
|
||||
candidates: readonly Candidate[]
|
||||
failedCandidates: readonly Candidate["providerID"][]
|
||||
cloud: (() => Promise<Cloud.CloudState>) | undefined
|
||||
@@ -34,7 +34,7 @@ interface AdapterResult {
|
||||
items: ReadonlyArray<Contract.UsageSnapshot>
|
||||
}
|
||||
|
||||
export interface Adapter {
|
||||
interface Adapter {
|
||||
cachePrefixes: readonly string[]
|
||||
cloudScoped?: boolean
|
||||
run(ctx: AdapterContext): Promise<AdapterResult>
|
||||
@@ -258,7 +258,7 @@ export interface TransportInterface {
|
||||
|
||||
export class Transport extends Context.Service<Transport, TransportInterface>()("@kilocode/ProviderUsageTransport") {}
|
||||
|
||||
export const transportLayer = Layer.succeed(Transport, {
|
||||
const transportLayer = Layer.succeed(Transport, {
|
||||
fetch,
|
||||
plans: Cloud.fetchCodingPlanSubscriptions,
|
||||
byok: Cloud.fetchByokEntries,
|
||||
|
||||
@@ -15,12 +15,12 @@ export const bindings = {
|
||||
},
|
||||
} as const
|
||||
|
||||
export type ProviderID = keyof typeof bindings
|
||||
type ProviderID = keyof typeof bindings
|
||||
|
||||
const timeout = 5_000
|
||||
const limit = 64 * 1024
|
||||
|
||||
export class MiniMaxUsageError extends Error {
|
||||
class MiniMaxUsageError extends Error {
|
||||
constructor(readonly code: "network" | "http" | "too_large" | "invalid" | "application") {
|
||||
super("MiniMax usage is temporarily unavailable.")
|
||||
this.name = "MiniMaxUsageError"
|
||||
|
||||
Reference in New Issue
Block a user