diff --git a/packages/core/src/plugin/system-prompt.ts b/packages/core/src/plugin/system-prompt.ts index 4756d67ef87..dca093fbe4b 100644 --- a/packages/core/src/plugin/system-prompt.ts +++ b/packages/core/src/plugin/system-prompt.ts @@ -23,7 +23,11 @@ export const GooglePlugin = make("google", (id) => (id.includes("gemini-") ? PRO export const AnthropicPlugin = make("anthropic", (id) => (id.includes("claude") ? PROMPT_ANTHROPIC : undefined)) export const KimiPlugin = make("kimi", (id) => (id.includes("kimi") ? PROMPT_KIMI : undefined)) export const ArceePlugin = make("arcee", (id) => (id.includes("trinity") ? PROMPT_TRINITY : undefined)) -export const MetaPlugin = make("meta", (id) => (id.includes("muse-spark") ? PROMPT_META : undefined)) +export const MetaPlugin = make("meta", (id) => { + if (!id.includes("muse")) return + const name = id.includes("muse-glimmer") ? "Muse Glimmer" : "Muse Spark" + return PROMPT_META.replaceAll("{{MODEL_NAME}}", name) +}) export const Plugins = [OpenAIPlugin, GooglePlugin, AnthropicPlugin, KimiPlugin, ArceePlugin, MetaPlugin] as const diff --git a/packages/core/src/plugin/system-prompt/meta.txt b/packages/core/src/plugin/system-prompt/meta.txt index a8f92270bbd..f31887a7d45 100644 --- a/packages/core/src/plugin/system-prompt/meta.txt +++ b/packages/core/src/plugin/system-prompt/meta.txt @@ -1,4 +1,4 @@ -You are OpenCode, a coding agent that helps users with software engineering tasks. You are powered by Muse Spark, a large language model trained by Meta MSL. +You are OpenCode, a coding agent that helps users with software engineering tasks. You are powered by {{MODEL_NAME}}, a large language model trained by Meta MSL. Use the instructions below and the tools available to assist the user. @@ -55,5 +55,5 @@ Use the instructions below and the tools available to assist the user. - NEVER use comments as a place for long-winded chain-of-thought. Long thinking texts must be generated as private reasoning. Comments in code must be appropriately concise. # User Help & Feedback -- Users can give feedback or report issues at https://github.com/anomalyco/opencode and mention that they are using Meta Muse Spark. +- Users can give feedback or report issues at https://github.com/anomalyco/opencode and mention that they are using Meta {{MODEL_NAME}}. - When users ask directly about OpenCode (eg. "can OpenCode do...", "are you able to do...") or its features (eg. implement a hook, write a slash command, or install an MCP server), use the `webfetch` tool to gather information to answer the question from the V2 OpenCode docs at https://opencode.ai/v2/docs/. diff --git a/packages/core/test/plugin/system-prompt.test.ts b/packages/core/test/plugin/system-prompt.test.ts index 78e98b575f1..c3246752919 100644 --- a/packages/core/test/plugin/system-prompt.test.ts +++ b/packages/core/test/plugin/system-prompt.test.ts @@ -90,6 +90,36 @@ describe("SystemPromptPlugin", () => { }), ) + it.effect("selects the Meta prompt for Muse family model IDs", () => + Effect.gen(function* () { + const hooks = yield* PluginHooks.Service + const pluginHost = yield* makeHost + yield* SystemPromptPlugin.MetaPlugin.effect(pluginHost) + + yield* Effect.forEach( + [ + ["meta/muse-spark-preview", "Muse Spark"], + ["muse-spark-1.2", "Muse Spark"], + ["meta/muse-glimmer-30b", "Muse Glimmer"], + ["muse-glimmer-30b", "Muse Glimmer"], + ] as const, + ([id, name]) => { + const event = context(id) + return hooks.trigger("session", "context", event).pipe( + Effect.tap(() => + Effect.sync(() => { + expect(event.system[0]?.text).toContain(`powered by ${name},`) + expect(event.system[0]?.text).toContain(`using Meta ${name}.`) + expect(event.system[0]?.text).not.toContain("{{MODEL_NAME}}") + }), + ), + ) + }, + { discard: true }, + ) + }), + ) + it.effect("preserves an explicit agent system prompt", () => Effect.gen(function* () { const agents = yield* Agent.Service