|
| 1 | +import type { Plugin } from "@opencode-ai/plugin" |
| 2 | + |
| 3 | +export const TestPlugin: Plugin = async () => { |
| 4 | + console.log("🎯 Test Plugin Loaded!") |
| 5 | + |
| 6 | + return { |
| 7 | + "prompt.before": async (input, output) => { |
| 8 | + console.log("\n" + "=".repeat(60)) |
| 9 | + console.log("🔥 PROMPT.BEFORE HOOK FIRED!") |
| 10 | + console.log("=".repeat(60)) |
| 11 | + console.log("Session:", input.sessionID) |
| 12 | + console.log("Agent:", input.agent) |
| 13 | + console.log("Prompt:", input.prompt.substring(0, 100)) |
| 14 | + console.log("Prompt length:", input.prompt.length) |
| 15 | + console.log("Current model:", input.model || "default") |
| 16 | + console.log("=".repeat(60) + "\n") |
| 17 | + |
| 18 | + // Test: switch to Haiku for "simple" prompts |
| 19 | + if (input.prompt.toLowerCase().includes("simple")) { |
| 20 | + output.model = { |
| 21 | + providerID: "anthropic", |
| 22 | + modelID: "claude-haiku-3-5" |
| 23 | + } |
| 24 | + console.log("✅ SWITCHED TO HAIKU FOR SIMPLE TASK\n") |
| 25 | + } |
| 26 | + |
| 27 | + // Test: switch to Sonnet for "complex" prompts |
| 28 | + if (input.prompt.toLowerCase().includes("complex") || input.prompt.toLowerCase().includes("refactor")) { |
| 29 | + output.model = { |
| 30 | + providerID: "anthropic", |
| 31 | + modelID: "claude-sonnet-4-5" |
| 32 | + } |
| 33 | + console.log("✅ SWITCHED TO SONNET 4.5 FOR COMPLEX TASK\n") |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | +} |
0 commit comments