Browse Source

ignore: rm spoof and bump plugin version

Aiden Cline 3 weeks ago
parent
commit
94dd0a8dbe

+ 3 - 2
packages/opencode/src/agent/agent.ts

@@ -17,6 +17,7 @@ import { PermissionNext } from "@/permission/next"
 import { mergeDeep, pipe, sortBy, values } from "remeda"
 import { Global } from "@/global"
 import path from "path"
+import { Plugin } from "@/plugin"
 
 export namespace Agent {
   export const Info = z
@@ -279,8 +280,8 @@ export namespace Agent {
     const model = await Provider.getModel(defaultModel.providerID, defaultModel.modelID)
     const language = await Provider.getLanguage(model)
 
-    const system = SystemPrompt.header(defaultModel.providerID)
-    system.push(PROMPT_GENERATE)
+    const system = [PROMPT_GENERATE]
+    await Plugin.trigger("experimental.chat.system.transform", { model }, { system })
     const existing = await list()
 
     const params = {

+ 1 - 1
packages/opencode/src/global/index.ts

@@ -33,7 +33,7 @@ await Promise.all([
   fs.mkdir(Global.Path.bin, { recursive: true }),
 ])
 
-const CACHE_VERSION = "18"
+const CACHE_VERSION = "19"
 
 const version = await Bun.file(path.join(Global.Path.cache, "version"))
   .text()

+ 1 - 1
packages/opencode/src/plugin/index.ts

@@ -15,7 +15,7 @@ import { CopilotAuthPlugin } from "./copilot"
 export namespace Plugin {
   const log = Log.create({ service: "plugin" })
 
-  const BUILTIN = ["[email protected].9", "@gitlab/[email protected]"]
+  const BUILTIN = ["[email protected].10", "@gitlab/[email protected]"]
 
   // Built-in plugins that are directly imported (not installed from npm)
   const INTERNAL_PLUGINS: PluginInstance[] = [CodexAuthPlugin, CopilotAuthPlugin]

+ 6 - 2
packages/opencode/src/session/llm.ts

@@ -66,7 +66,7 @@ export namespace LLM {
     ])
     const isCodex = provider.id === "openai" && auth?.type === "oauth"
 
-    const system = SystemPrompt.header(input.model.providerID)
+    const system = []
     system.push(
       [
         // use agent prompt otherwise provider prompt
@@ -83,7 +83,11 @@ export namespace LLM {
 
     const header = system[0]
     const original = clone(system)
-    await Plugin.trigger("experimental.chat.system.transform", { sessionID: input.sessionID }, { system })
+    await Plugin.trigger(
+      "experimental.chat.system.transform",
+      { sessionID: input.sessionID, model: input.model },
+      { system },
+    )
     if (system.length === 0) {
       system.push(...original)
     }

+ 0 - 1
packages/opencode/src/session/prompt/anthropic_spoof.txt

@@ -1 +0,0 @@
-You are Claude Code, Anthropic's official CLI for Claude.

+ 0 - 5
packages/opencode/src/session/system.ts

@@ -34,11 +34,6 @@ async function resolveRelativeInstruction(instruction: string): Promise<string[]
 }
 
 export namespace SystemPrompt {
-  export function header(providerID: string) {
-    if (providerID.includes("anthropic")) return [PROMPT_ANTHROPIC_SPOOF.trim()]
-    return []
-  }
-
   export function instructions() {
     return PROMPT_CODEX.trim()
   }

+ 1 - 1
packages/plugin/src/index.ts

@@ -203,7 +203,7 @@ export interface Hooks {
     },
   ) => Promise<void>
   "experimental.chat.system.transform"?: (
-    input: { sessionID: string },
+    input: { sessionID?: string; model: Model },
     output: {
       system: string[]
     },