File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
packages/opencode/src/session Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -47,8 +47,10 @@ export namespace LLM {
4747 const [ language , cfg ] = await Promise . all ( [ Provider . getLanguage ( input . model ) , Config . get ( ) ] )
4848
4949 const system = SystemPrompt . header ( input . model . providerID )
50+ const assistantInfo = await SystemPrompt . assistantInfo ( input . model )
5051 system . push (
5152 [
53+ assistantInfo ,
5254 // use agent prompt otherwise provider prompt
5355 ...( input . agent . prompt ? [ input . agent . prompt ] : SystemPrompt . provider ( input . model ) ) ,
5456 // any custom prompt passed into this call
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import { Ripgrep } from "../file/ripgrep"
22import { Global } from "../global"
33import { Filesystem } from "../util/filesystem"
44import { Config } from "../config/config"
5+ import { Installation } from "../installation"
6+ import { Provider } from "../provider/provider"
57
68import { Instance } from "../project/instance"
79import path from "path"
@@ -14,14 +16,19 @@ import PROMPT_GEMINI from "./prompt/gemini.txt"
1416import PROMPT_ANTHROPIC_SPOOF from "./prompt/anthropic_spoof.txt"
1517
1618import PROMPT_CODEX from "./prompt/codex.txt"
17- import type { Provider } from "@/provider/provider"
1819
1920export namespace SystemPrompt {
2021 export function header ( providerID : string ) {
2122 if ( providerID . includes ( "anthropic" ) ) return [ PROMPT_ANTHROPIC_SPOOF . trim ( ) ]
2223 return [ ]
2324 }
2425
26+ export async function assistantInfo ( model ?: Provider . Model ) {
27+ if ( ! model ) return `You are running in OpenCode v${ Installation . VERSION } , the best coding agent on the planet.`
28+ const provider = await Provider . getProvider ( model . providerID )
29+ return `You are ${ model . name } (${ provider . name } : ${ model . id } ) running in OpenCode v${ Installation . VERSION } , the best coding agent on the planet.`
30+ }
31+
2532 export function provider ( model : Provider . Model ) {
2633 if ( model . api . id . includes ( "gpt-5" ) ) return [ PROMPT_CODEX ]
2734 if ( model . api . id . includes ( "gpt-" ) || model . api . id . includes ( "o1" ) || model . api . id . includes ( "o3" ) )
You can’t perform that action at this time.
0 commit comments