feat: 全面清除用户/AI可见的 opencode 痕迹
Some checks failed
compliance-close / close-non-compliant (push) Has been cancelled
beta / sync (push) Has been cancelled

- system.ts 不再把真实 model id 喂给 LLM(修复"底层是opencode/big-pickle")
- TUI 首页 tips、窗口标题、ACP 弹窗、命令提示文案全部 → zmo
- config schema URL → zmo.dev;配置路径提示 → ~/.config/zmo、.zmo/
- 发给各家 LLM API 的标识头(X-Title/Referer/Source/UA/originator)→ zmo
- 保留:opencode provider 路由id、@opencode-ai 包名、opencode.json/OPENCODE_* 兼容

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 17:49:47 +08:00
parent 9970e6c1ad
commit 5bd92a3535
21 changed files with 81 additions and 82 deletions

View File

@@ -10,7 +10,7 @@ export const CerebrasPlugin = PluginV2.define({
if (item.provider.api.type !== "aisdk") continue
if (item.provider.api.package !== "@ai-sdk/cerebras") continue
ctx.provider.update(item.provider.id, (provider) => {
provider.request.headers["X-Cerebras-3rd-Party-Integration"] = "opencode"
provider.request.headers["X-Cerebras-3rd-Party-Integration"] = "zmo"
})
}
}),

View File

@@ -71,7 +71,7 @@ function gatewayOptions(options: Record<string, unknown>, metadata: unknown) {
skipCache: options.skipCache,
collectLog: options.collectLog,
headers: {
"User-Agent": `opencode/${InstallationVersion} cloudflare-ai-gateway (${os.platform()} ${os.release()}; ${os.arch()})`,
"User-Agent": `zmo/${InstallationVersion} cloudflare-ai-gateway (${os.platform()} ${os.release()}; ${os.arch()})`,
},
}
}

View File

@@ -54,7 +54,7 @@ function sdkOptions(options: Record<string, any>) {
baseURL: expandAccountId(options.baseURL),
apiKey: process.env.CLOUDFLARE_API_KEY ?? options.apiKey,
headers: {
"User-Agent": `opencode/${InstallationVersion} cloudflare-workers-ai (${os.platform()} ${os.release()}; ${os.arch()})`,
"User-Agent": `zmo/${InstallationVersion} cloudflare-workers-ai (${os.platform()} ${os.release()}; ${os.arch()})`,
...options.headers,
},
name: providerID,

View File

@@ -19,7 +19,7 @@ export const GitLabPlugin = PluginV2.define({
: (process.env.GITLAB_INSTANCE_URL ?? "https://gitlab.com"),
apiKey: typeof evt.options.apiKey === "string" ? evt.options.apiKey : process.env.GITLAB_TOKEN,
aiGatewayHeaders: {
"User-Agent": `opencode/${InstallationVersion} gitlab-ai-provider/${mod.VERSION} (${os.platform()} ${os.release()}; ${os.arch()})`,
"User-Agent": `zmo/${InstallationVersion} gitlab-ai-provider/${mod.VERSION} (${os.platform()} ${os.release()}; ${os.arch()})`,
"anthropic-beta": "context-1m-2025-08-07",
...evt.options.aiGatewayHeaders,
},

View File

@@ -11,8 +11,8 @@ export const KiloPlugin = PluginV2.define({
if (item.provider.api.package !== "@ai-sdk/openai-compatible") continue
if (item.provider.api.url !== "https://api.kilo.ai/api/gateway") continue
evt.provider.update(item.provider.id, (provider) => {
provider.request.headers["HTTP-Referer"] = "https://opencode.ai/"
provider.request.headers["X-Title"] = "opencode"
provider.request.headers["HTTP-Referer"] = "https://github.com/helpLogin/zmo-cli"
provider.request.headers["X-Title"] = "zmo"
})
}
}),

View File

@@ -12,9 +12,9 @@ export const LLMGatewayPlugin = PluginV2.define({
if (item.provider.api.package !== "@ai-sdk/openai-compatible") continue
if (item.provider.api.url !== "https://api.llmgateway.io/v1") continue
evt.provider.update(item.provider.id, (provider) => {
provider.request.headers["HTTP-Referer"] = "https://opencode.ai/"
provider.request.headers["X-Title"] = "opencode"
provider.request.headers["X-Source"] = "opencode"
provider.request.headers["HTTP-Referer"] = "https://github.com/helpLogin/zmo-cli"
provider.request.headers["X-Title"] = "zmo"
provider.request.headers["X-Source"] = "zmo"
})
}
}),

View File

@@ -11,9 +11,9 @@ export const NvidiaPlugin = PluginV2.define({
if (item.provider.api.package !== "@ai-sdk/openai-compatible") continue
if (item.provider.api.url !== "https://integrate.api.nvidia.com/v1") continue
evt.provider.update(item.provider.id, (provider) => {
provider.request.headers["HTTP-Referer"] = "https://opencode.ai/"
provider.request.headers["X-Title"] = "opencode"
provider.request.headers["X-BILLING-INVOKE-ORIGIN"] ??= "OpenCode"
provider.request.headers["HTTP-Referer"] = "https://github.com/helpLogin/zmo-cli"
provider.request.headers["X-Title"] = "zmo"
provider.request.headers["X-BILLING-INVOKE-ORIGIN"] ??= "zmo"
})
}
}),

View File

@@ -11,8 +11,8 @@ export const OpenRouterPlugin = PluginV2.define({
if (item.provider.api.type !== "aisdk") continue
if (item.provider.api.package !== "@openrouter/ai-sdk-provider") continue
evt.provider.update(item.provider.id, (provider) => {
provider.request.headers["HTTP-Referer"] = "https://opencode.ai/"
provider.request.headers["X-Title"] = "opencode"
provider.request.headers["HTTP-Referer"] = "https://github.com/helpLogin/zmo-cli"
provider.request.headers["X-Title"] = "zmo"
})
for (const modelID of [ModelV2.ID.make("gpt-5-chat-latest"), ModelV2.ID.make("openai/gpt-5-chat")]) {
if (!item.models.has(modelID)) continue

View File

@@ -10,8 +10,8 @@ export const VercelPlugin = PluginV2.define({
if (item.provider.api.type !== "aisdk") continue
if (item.provider.api.package !== "@ai-sdk/vercel") continue
evt.provider.update(item.provider.id, (provider) => {
provider.request.headers["http-referer"] = "https://opencode.ai/"
provider.request.headers["x-title"] = "opencode"
provider.request.headers["http-referer"] = "https://github.com/helpLogin/zmo-cli"
provider.request.headers["x-title"] = "zmo"
})
}
}),