summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/opencode/src/flag/flag.ts1
-rw-r--r--packages/opencode/src/installation/index.ts3
-rw-r--r--packages/opencode/src/session/prompt.ts1
-rw-r--r--packages/tauri/src-tauri/src/lib.rs1
4 files changed, 5 insertions, 1 deletions
diff --git a/packages/opencode/src/flag/flag.ts b/packages/opencode/src/flag/flag.ts
index 36cebf6aa..2dcf112ae 100644
--- a/packages/opencode/src/flag/flag.ts
+++ b/packages/opencode/src/flag/flag.ts
@@ -11,6 +11,7 @@ export namespace Flag {
export const OPENCODE_ENABLE_EXPERIMENTAL_MODELS = truthy("OPENCODE_ENABLE_EXPERIMENTAL_MODELS")
export const OPENCODE_DISABLE_AUTOCOMPACT = truthy("OPENCODE_DISABLE_AUTOCOMPACT")
export const OPENCODE_FAKE_VCS = process.env["OPENCODE_FAKE_VCS"]
+ export const OPENCODE_CLIENT = process.env["OPENCODE_CLIENT"] ?? "cli"
// Experimental
export const OPENCODE_EXPERIMENTAL = truthy("OPENCODE_EXPERIMENTAL")
diff --git a/packages/opencode/src/installation/index.ts b/packages/opencode/src/installation/index.ts
index d630c3f93..0359c16fe 100644
--- a/packages/opencode/src/installation/index.ts
+++ b/packages/opencode/src/installation/index.ts
@@ -6,6 +6,7 @@ import z from "zod"
import { NamedError } from "@opencode-ai/util/error"
import { Log } from "../util/log"
import { iife } from "@/util/iife"
+import { Flag } from "../flag/flag"
declare global {
const OPENCODE_VERSION: string
@@ -162,7 +163,7 @@ export namespace Installation {
export const VERSION = typeof OPENCODE_VERSION === "string" ? OPENCODE_VERSION : "local"
export const CHANNEL = typeof OPENCODE_CHANNEL === "string" ? OPENCODE_CHANNEL : "local"
- export const USER_AGENT = `opencode/${CHANNEL}/${VERSION}`
+ export const USER_AGENT = `opencode/${CHANNEL}/${VERSION}/${Flag.OPENCODE_CLIENT}`
export async function latest(installMethod?: Method) {
const detectedMethod = installMethod || (await method())
diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts
index d31153331..1f5361af6 100644
--- a/packages/opencode/src/session/prompt.ts
+++ b/packages/opencode/src/session/prompt.ts
@@ -590,6 +590,7 @@ export namespace SessionPrompt {
"x-opencode-project": Instance.project.id,
"x-opencode-session": sessionID,
"x-opencode-request": lastUser.id,
+ "x-opencode-client": Flag.OPENCODE_CLIENT,
}
: undefined),
...model.headers,
diff --git a/packages/tauri/src-tauri/src/lib.rs b/packages/tauri/src-tauri/src/lib.rs
index d79932574..5c4304d51 100644
--- a/packages/tauri/src-tauri/src/lib.rs
+++ b/packages/tauri/src-tauri/src/lib.rs
@@ -67,6 +67,7 @@ fn spawn_sidecar(app: &AppHandle, port: u16) -> CommandChild {
.sidecar("opencode")
.unwrap()
.env("OPENCODE_EXPERIMENTAL_ICON_DISCOVERY", "true")
+ .env("OPENCODE_CLIENT", "desktop")
.args(["serve", &format!("--port={port}")])
.spawn()
.expect("Failed to spawn opencode");