From cd67db950163e8c0419867958fd278a4c8b16852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Catriel=20M=C3=BCller?= Date: Fri, 8 May 2026 14:54:30 -0300 Subject: [PATCH] fix: kilocode markers --- packages/opencode/src/project/bootstrap.ts | 4 +++- packages/opencode/src/provider/model-cache.ts | 2 +- .../instance/httpapi/handlers/provider.ts | 2 +- .../instance/httpapi/handlers/session.ts | 3 ++- .../src/server/routes/instance/project.ts | 2 ++ packages/opencode/src/session/instruction.ts | 2 +- .../opencode/test/config/agent-color.test.ts | 8 +++++-- .../ui/src/components/provider-icons/types.ts | 24 +++++++++---------- 8 files changed, 28 insertions(+), 19 deletions(-) diff --git a/packages/opencode/src/project/bootstrap.ts b/packages/opencode/src/project/bootstrap.ts index ac83b4ca2c..8ffb780aef 100644 --- a/packages/opencode/src/project/bootstrap.ts +++ b/packages/opencode/src/project/bootstrap.ts @@ -45,16 +45,18 @@ export const layer = Layer.effect( // Plugin can mutate config so it has to be initialized before anything else. yield* plugin.init() yield* Effect.promise(() => KilocodeBootstrap.init()).pipe(Effect.forkDetach) // kilocode_change + // kilocode_change start - shareNext removed from list, handled by KilocodeBootstrap yield* Effect.all( [ lsp, - /* shareNext, kilocode_change - handled by KilocodeBootstrap */ format, + format, file, fileWatcher, vcs, snapshot, ].map((s) => Effect.forkDetach(s.init())), ).pipe(Effect.withSpan("InstanceBootstrap.init")) + // kilocode_change end const projectID = ctx.project.id yield* bus.subscribeCallback(Command.Event.Executed, async (payload) => { diff --git a/packages/opencode/src/provider/model-cache.ts b/packages/opencode/src/provider/model-cache.ts index df10863528..37cb47d53e 100644 --- a/packages/opencode/src/provider/model-cache.ts +++ b/packages/opencode/src/provider/model-cache.ts @@ -1,4 +1,4 @@ -// kilocode_change new file +// kilocode_change - new file import { fetchKiloModels, type KiloModelsResult } from "@kilocode/kilo-gateway" import { Config } from "../config/config" import { Auth } from "../auth" diff --git a/packages/opencode/src/server/routes/instance/httpapi/handlers/provider.ts b/packages/opencode/src/server/routes/instance/httpapi/handlers/provider.ts index de2da31865..ede3df0563 100644 --- a/packages/opencode/src/server/routes/instance/httpapi/handlers/provider.ts +++ b/packages/opencode/src/server/routes/instance/httpapi/handlers/provider.ts @@ -3,7 +3,7 @@ import { Config } from "@/config/config" import { ModelsDev } from "@/provider/models" import { Provider } from "@/provider/provider" import { ProviderID } from "@/provider/schema" -import { mapValues, pickBy } from "remeda" +import { mapValues, pickBy } from "remeda" // kilocode_change import { ModelCache } from "@/provider/model-cache" // kilocode_change import { Effect, Schema } from "effect" import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http" diff --git a/packages/opencode/src/server/routes/instance/httpapi/handlers/session.ts b/packages/opencode/src/server/routes/instance/httpapi/handlers/session.ts index bf4edf9195..67fcdb80ff 100644 --- a/packages/opencode/src/server/routes/instance/httpapi/handlers/session.ts +++ b/packages/opencode/src/server/routes/instance/httpapi/handlers/session.ts @@ -274,7 +274,7 @@ export const sessionHandlers = HttpApiBuilder.group(InstanceHttpApi, "session", params: { sessionID: SessionID } payload: typeof PromptPayload.Type }) { - // kilocode_change - cast to bridge schema-readonly→PromptInput-mutable; matches legacy Hono session.ts + // kilocode_change start - cast to bridge schema-readonly→PromptInput-mutable; matches legacy Hono session.ts yield* promptSvc .prompt({ ...ctx.payload, sessionID: ctx.params.sessionID } as unknown as SessionPrompt.PromptInput) .pipe( @@ -289,6 +289,7 @@ export const sessionHandlers = HttpApiBuilder.group(InstanceHttpApi, "session", ), Effect.forkIn(scope, { startImmediately: true }), ) + // kilocode_change end return HttpApiSchema.NoContent.make() }) diff --git a/packages/opencode/src/server/routes/instance/project.ts b/packages/opencode/src/server/routes/instance/project.ts index 01a45c2fb9..00bb4357e3 100644 --- a/packages/opencode/src/server/routes/instance/project.ts +++ b/packages/opencode/src/server/routes/instance/project.ts @@ -82,12 +82,14 @@ export const ProjectRoutes = lazy(() => Project.Service.use((svc) => svc.initGit({ directory: dir, project: prev })), ) if (next.id === prev.id && next.vcs === prev.vcs && next.worktree === prev.worktree) return c.json(next) + // kilocode_change start await InstanceStore.reloadInstance({ directory: dir, worktree: dir, project: next, init: await getBootstrapRunEffect(), }) + // kilocode_change end return c.json(next) }, ) diff --git a/packages/opencode/src/session/instruction.ts b/packages/opencode/src/session/instruction.ts index ba7c07b93b..d0be1dd401 100644 --- a/packages/opencode/src/session/instruction.ts +++ b/packages/opencode/src/session/instruction.ts @@ -84,7 +84,7 @@ export const layer: Layer.Layer< } // kilocode_change - prefer KILO_CONFIG_DIR profile when set, else fall back to global.config const root = Flag.KILO_CONFIG_DIR ?? global.config - return yield* fs.globUp(instruction, root, root).pipe(Effect.catch(() => Effect.succeed([] as string[]))) + return yield* fs.globUp(instruction, root, root).pipe(Effect.catch(() => Effect.succeed([] as string[]))) // kilocode_change }) const read = Effect.fnUntraced(function* (filepath: string) { diff --git a/packages/opencode/test/config/agent-color.test.ts b/packages/opencode/test/config/agent-color.test.ts index ffd636c38e..1255b37299 100644 --- a/packages/opencode/test/config/agent-color.test.ts +++ b/packages/opencode/test/config/agent-color.test.ts @@ -22,22 +22,25 @@ const writeConfig = (dir: string, agent: Config.Info["agent"]) => ), ) +// kilocode_change start it.live("agent color parsed from project config", () => Effect.gen(function* () { const dir = yield* tmpdirScoped() yield* writeConfig(dir, { - code: { color: "#FFA500" }, // kilocode_change + code: { color: "#FFA500" }, plan: { color: "primary" }, }) yield* Effect.gen(function* () { const cfg = yield* Effect.promise(() => AppRuntime.runPromise(Config.Service.use((svc) => svc.get()))) - expect(cfg.agent?.["code"]?.color).toBe("#FFA500") // kilocode_change + expect(cfg.agent?.["code"]?.color).toBe("#FFA500") expect(cfg.agent?.["plan"]?.color).toBe("primary") }).pipe(provideInstance(dir)) }), ) +// kilocode_change end +// kilocode_change start it.live("Agent.get includes color from config", () => Effect.gen(function* () { const dir = yield* tmpdirScoped() @@ -54,6 +57,7 @@ it.live("Agent.get includes color from config", () => }).pipe(provideInstance(dir)) }), ) +// kilocode_change end test("Color.hexToAnsiBold converts valid hex to ANSI", () => { const result = Color.hexToAnsiBold("#FFA500") diff --git a/packages/ui/src/components/provider-icons/types.ts b/packages/ui/src/components/provider-icons/types.ts index 03f0bf4854..a99835ce53 100644 --- a/packages/ui/src/components/provider-icons/types.ts +++ b/packages/ui/src/components/provider-icons/types.ts @@ -7,12 +7,12 @@ export const iconNames = [ "zai", "zai-coding-plan", "xiaomi", - "xiaomi-token-plan-sgp", - "xiaomi-token-plan-cn", - "xiaomi-token-plan-ams", + "xiaomi-token-plan-sgp", // kilocode_change + "xiaomi-token-plan-cn", // kilocode_change + "xiaomi-token-plan-ams", // kilocode_change "xai", "wandb", - "wafer.ai", + "wafer.ai", // kilocode_change "vultr", "vivgrid", "vercel", @@ -20,8 +20,8 @@ export const iconNames = [ "v0", "upstage", "togetherai", - "the-grid-ai", - "tencent-tokenhub", + "the-grid-ai", // kilocode_change + "tencent-tokenhub", // kilocode_change "tencent-coding-plan", "synthetic", "submodel", @@ -32,7 +32,7 @@ export const iconNames = [ "scaleway", "sap-ai-core", "requesty", - "regolo-ai", + "regolo-ai", // kilocode_change "qiniu-ai", "qihang-ai", "privatemode-ai", @@ -55,7 +55,7 @@ export const iconNames = [ "moonshotai-cn", "modelscope", "moark", - "mixlayer", + "mixlayer", // kilocode_change "mistral", "minimax", "minimax-coding-plan", @@ -64,7 +64,7 @@ export const iconNames = [ "meganova", "lucidquery", "lmstudio", - "llmgateway", + "llmgateway", // kilocode_change "llama", "kuae-cloud-coding-plan", "kimi-for-coding", @@ -75,7 +75,7 @@ export const iconNames = [ "inception", "iflowcn", "huggingface", - "hpc-ai", + "hpc-ai", // kilocode_change "helicone", "groq", "google", @@ -91,7 +91,7 @@ export const iconNames = [ "evroc", "drun", "dinference", - "digitalocean", + "digitalocean", // kilocode_change "deepseek", "deepinfra", "cortecs", @@ -114,7 +114,7 @@ export const iconNames = [ "alibaba-coding-plan-cn", "alibaba-cn", "aihubmix", - "abliteration-ai", + "abliteration-ai", // kilocode_change "abacus", "302ai", ] as const