mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-11-29 02:17:48 +08:00
Marketplace catalog discovery, install, removal, and installed-item detection lived in the VS Code extension, so any other editor client would have had to reimplement catalog parsing, scope resolution, config writing, and archive extraction. Move that logic behind three CLI endpoints and make the extension a client of them, so every editor shares one marketplace implementation over the SDK: GET /kilocode/marketplace catalog + installed detection per scope POST /kilocode/marketplace/install install an MCP server, agent, or skill POST /kilocode/marketplace/remove remove an MCP server, agent, or skill No user-visible change in VS Code. The panel UI and suggestion relevance stay client-side, since relevance depends on installed VS Code extensions. The contract is shaped for generated clients so the JetBrains plugin can build on it: response and model schemas are named rather than inline, and install takes an item's type, id, and content instead of a full catalog entry.
45 lines
2.4 KiB
TypeScript
45 lines
2.4 KiB
TypeScript
import { Flag } from "@opencode-ai/core/flag/flag"
|
|
import { Effect } from "effect"
|
|
import path from "path"
|
|
|
|
const preserveExerciseGlobalRoot = !!process.env.KILO_HTTPAPI_EXERCISE_GLOBAL
|
|
export const exerciseGlobalRoot =
|
|
process.env.KILO_HTTPAPI_EXERCISE_GLOBAL ??
|
|
path.join(process.env.TMPDIR ?? "/tmp", `opencode-httpapi-global-${process.pid}`)
|
|
process.env.XDG_DATA_HOME = path.join(exerciseGlobalRoot, "data")
|
|
process.env.XDG_CONFIG_HOME = path.join(exerciseGlobalRoot, "config")
|
|
process.env.XDG_STATE_HOME = path.join(exerciseGlobalRoot, "state")
|
|
process.env.XDG_CACHE_HOME = path.join(exerciseGlobalRoot, "cache")
|
|
process.env.KILO_DISABLE_SHARE = "true"
|
|
process.env.KILO_DISABLE_SESSION_INGEST = "true" // kilocode_change - isolate the exerciser from async Kilo session sync
|
|
process.env.KILO_DISABLE_PRESENCE = "1" // kilocode_change - presence now has a default Event Service URL; never open real sockets from the exerciser
|
|
process.env.KILO_DISABLE_CODEBASE_INDEXING = "vscode-no-workspace" // kilocode_change - route scenarios do not need an indexing worker per temp project
|
|
process.env.KILO_MARKETPLACE_BASE_URL = "http://127.0.0.1:9" // kilocode_change - keep marketplace catalog fetches hermetic; the list scenario degrades to an empty catalog instead of calling api.kilo.ai
|
|
export const exerciseConfigDirectory = path.join(exerciseGlobalRoot, "config", "opencode")
|
|
export const exerciseDataDirectory = path.join(exerciseGlobalRoot, "data", "kilo") // kilocode_change
|
|
|
|
const preserveExerciseDatabase = !!process.env.KILO_HTTPAPI_EXERCISE_DB
|
|
export const exerciseDatabasePath =
|
|
process.env.KILO_HTTPAPI_EXERCISE_DB ??
|
|
path.join(process.env.TMPDIR ?? "/tmp", `opencode-httpapi-exercise-${process.pid}.db`)
|
|
process.env.KILO_DB = exerciseDatabasePath
|
|
Flag.KILO_DB = exerciseDatabasePath
|
|
|
|
export const original = {
|
|
KILO_SERVER_PASSWORD: Flag.KILO_SERVER_PASSWORD,
|
|
KILO_SERVER_USERNAME: Flag.KILO_SERVER_USERNAME,
|
|
}
|
|
|
|
export const cleanupExercisePaths = Effect.promise(async () => {
|
|
const fs = await import("fs/promises")
|
|
if (!preserveExerciseDatabase) {
|
|
await Promise.all(
|
|
[exerciseDatabasePath, `${exerciseDatabasePath}-wal`, `${exerciseDatabasePath}-shm`].map((file) =>
|
|
fs.rm(file, { force: true }).catch(() => undefined),
|
|
),
|
|
)
|
|
}
|
|
if (!preserveExerciseGlobalRoot)
|
|
await fs.rm(exerciseGlobalRoot, { recursive: true, force: true }).catch(() => undefined)
|
|
})
|