File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export namespace Flag {
1111 export const OPENCODE_ENABLE_EXPERIMENTAL_MODELS = truthy ( "OPENCODE_ENABLE_EXPERIMENTAL_MODELS" )
1212 export const OPENCODE_DISABLE_AUTOCOMPACT = truthy ( "OPENCODE_DISABLE_AUTOCOMPACT" )
1313 export const OPENCODE_FAKE_VCS = process . env [ "OPENCODE_FAKE_VCS" ]
14+ export const OPENCODE_CLIENT = process . env [ "OPENCODE_CLIENT" ] ?? "cli"
1415
1516 // Experimental
1617 export const OPENCODE_EXPERIMENTAL = truthy ( "OPENCODE_EXPERIMENTAL" )
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import z from "zod"
66import { NamedError } from "@opencode-ai/util/error"
77import { Log } from "../util/log"
88import { iife } from "@/util/iife"
9+ import { Flag } from "../flag/flag"
910
1011declare global {
1112 const OPENCODE_VERSION : string
@@ -162,7 +163,7 @@ export namespace Installation {
162163
163164 export const VERSION = typeof OPENCODE_VERSION === "string" ? OPENCODE_VERSION : "local"
164165 export const CHANNEL = typeof OPENCODE_CHANNEL === "string" ? OPENCODE_CHANNEL : "local"
165- export const USER_AGENT = `opencode/${ CHANNEL } /${ VERSION } `
166+ export const USER_AGENT = `opencode/${ CHANNEL } /${ VERSION } / ${ Flag . OPENCODE_CLIENT } `
166167
167168 export async function latest ( installMethod ?: Method ) {
168169 const detectedMethod = installMethod || ( await method ( ) )
Original file line number Diff line number Diff line change @@ -590,6 +590,7 @@ export namespace SessionPrompt {
590590 "x-opencode-project" : Instance . project . id ,
591591 "x-opencode-session" : sessionID ,
592592 "x-opencode-request" : lastUser . id ,
593+ "x-opencode-client" : Flag . OPENCODE_CLIENT ,
593594 }
594595 : undefined ) ,
595596 ...model . headers ,
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ fn spawn_sidecar(app: &AppHandle, port: u16) -> CommandChild {
6767 . sidecar ( "opencode" )
6868 . unwrap ( )
6969 . env ( "OPENCODE_EXPERIMENTAL_ICON_DISCOVERY" , "true" )
70+ . env ( "OPENCODE_CLIENT" , "desktop" )
7071 . args ( [ "serve" , & format ! ( "--port={port}" ) ] )
7172 . spawn ( )
7273 . expect ( "Failed to spawn opencode" ) ;
You can’t perform that action at this time.
0 commit comments