diff --git a/src/agents/builtin-agents/agent-overrides.ts b/src/agents/builtin-agents/agent-overrides.ts index 5e705b02..ad80e8d6 100644 --- a/src/agents/builtin-agents/agent-overrides.ts +++ b/src/agents/builtin-agents/agent-overrides.ts @@ -27,6 +27,10 @@ export function applyCategoryOverride( if (categoryConfig.top_p !== undefined) result.top_p = categoryConfig.top_p if (categoryConfig.maxTokens !== undefined) result.maxTokens = categoryConfig.maxTokens + if (categoryConfig.prompt_append && typeof result.prompt === "string") { + result.prompt = result.prompt + "\n" + categoryConfig.prompt_append + } + return result as AgentConfig } diff --git a/src/cli/doctor/checks/model-resolution-cache.ts b/src/cli/doctor/checks/model-resolution-cache.ts index 9628db9e..7c1b7523 100644 --- a/src/cli/doctor/checks/model-resolution-cache.ts +++ b/src/cli/doctor/checks/model-resolution-cache.ts @@ -1,6 +1,7 @@ import { existsSync, readFileSync } from "node:fs" import { homedir } from "node:os" import { join } from "node:path" +import { parseJsonc } from "../../../shared" import type { AvailableModelsInfo } from "./model-resolution-types" function getOpenCodeCacheDir(): string { @@ -18,7 +19,7 @@ export function loadAvailableModelsFromCache(): AvailableModelsInfo { try { const content = readFileSync(cacheFile, "utf-8") - const data = JSON.parse(content) as Record }> + const data = parseJsonc }>>(content) const providers = Object.keys(data) let modelCount = 0 diff --git a/src/cli/doctor/checks/model-resolution-config.ts b/src/cli/doctor/checks/model-resolution-config.ts index e84853ee..db01cc4e 100644 --- a/src/cli/doctor/checks/model-resolution-config.ts +++ b/src/cli/doctor/checks/model-resolution-config.ts @@ -1,12 +1,13 @@ import { readFileSync } from "node:fs" -import { homedir } from "node:os" import { join } from "node:path" -import { detectConfigFile, parseJsonc } from "../../../shared" +import { detectConfigFile, getOpenCodeConfigPaths, parseJsonc } from "../../../shared" import type { OmoConfig } from "./model-resolution-types" const PACKAGE_NAME = "oh-my-opencode" -const USER_CONFIG_DIR = join(homedir(), ".config", "opencode") -const USER_CONFIG_BASE = join(USER_CONFIG_DIR, PACKAGE_NAME) +const USER_CONFIG_BASE = join( + getOpenCodeConfigPaths({ binary: "opencode", version: null }).configDir, + PACKAGE_NAME +) const PROJECT_CONFIG_BASE = join(process.cwd(), ".opencode", PACKAGE_NAME) export function loadOmoConfig(): OmoConfig | null {