Dax Raad 4 tháng trước cách đây
mục cha
commit
521fba8ce3
2 tập tin đã thay đổi với 13 bổ sung38 xóa
  1. 13 11
      packages/opencode/src/session/llm.ts
  2. 0 27
      packages/opencode/src/tool/bash.ts

+ 13 - 11
packages/opencode/src/session/llm.ts

@@ -46,17 +46,19 @@ export namespace LLM {
     })
     const [language, cfg] = await Promise.all([Provider.getLanguage(input.model), Config.get()])
 
-    const [first, ...rest] = [
-      // header prompt for providers with auth checks
-      ...SystemPrompt.header(input.model.providerID),
-      // use agent prompt otherwise provider prompt
-      ...(input.agent.prompt ? [input.agent.prompt] : SystemPrompt.provider(input.model)),
-      // any custom prompt passed into this call
-      ...input.system,
-      // any custom prompt from last user message
-      ...(input.user.system ? [input.user.system] : []),
-    ]
-    const system = [first, rest.join("\n")].filter((x) => x)
+    const system = SystemPrompt.header(input.model.providerID)
+    system.push(
+      [
+        // use agent prompt otherwise provider prompt
+        ...(input.agent.prompt ? [input.agent.prompt] : SystemPrompt.provider(input.model)),
+        // any custom prompt passed into this call
+        ...input.system,
+        // any custom prompt from last user message
+        ...(input.user.system ? [input.user.system] : []),
+      ]
+        .filter((x) => x)
+        .join("\n"),
+    )
 
     const params = await Plugin.trigger(
       "chat.params",

+ 0 - 27
packages/opencode/src/tool/bash.ts

@@ -49,33 +49,6 @@ const parser = lazy(async () => {
   return p
 })
 
-const getShell = lazy(() => {
-  const s = process.env.SHELL
-  if (s) {
-    const basename = path.basename(s)
-    if (!new Set(["fish", "nu"]).has(basename)) {
-      return s
-    }
-  }
-
-  if (process.platform === "darwin") {
-    return "/bin/zsh"
-  }
-
-  if (process.platform === "win32") {
-    // Let Bun / Node pick COMSPEC (usually cmd.exe)
-    // or explicitly:
-    return process.env.COMSPEC || true
-  }
-
-  const bash = Bun.which("bash")
-  if (bash) {
-    return bash
-  }
-
-  return true
-})
-
 // TODO: we may wanna rename this tool so it works better on other shells
 export const BashTool = Tool.define("bash", async () => {
   const shell = Shell.acceptable()