feat(hooks): add sisyphus-gpt-hephaestus-reminder hook
Shows error toast when Sisyphus runs with a GPT model, nudging user to use Hephaestus instead. 🤖 Generated with [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin"
|
||||
import { getSessionAgent } from "../../features/claude-code-session-state"
|
||||
import { log } from "../../shared"
|
||||
|
||||
const TOAST_TITLE = "Use Hephaestus for GPT Models"
|
||||
const TOAST_MESSAGE = "Sisyphus is using a GPT model. Use Hephaestus and include 'ulw' in your prompt."
|
||||
|
||||
export function createSisyphusGptHephaestusReminderHook(ctx: PluginInput) {
|
||||
return {
|
||||
"chat.message": async (input: {
|
||||
sessionID: string
|
||||
agent?: string
|
||||
model?: { providerID: string; modelID: string }
|
||||
}): Promise<void> => {
|
||||
const agentName = (input.agent ?? getSessionAgent(input.sessionID) ?? "").toLowerCase()
|
||||
const modelID = input.model?.modelID?.toLowerCase() ?? ""
|
||||
|
||||
if (agentName !== "sisyphus" || !modelID.includes("gpt")) {
|
||||
return
|
||||
}
|
||||
|
||||
await ctx.client.tui.showToast({
|
||||
body: {
|
||||
title: TOAST_TITLE,
|
||||
message: TOAST_MESSAGE,
|
||||
variant: "error",
|
||||
duration: 5000,
|
||||
},
|
||||
}).catch((error) => {
|
||||
log("[sisyphus-gpt-hephaestus-reminder] Failed to show toast", {
|
||||
sessionID: input.sessionID,
|
||||
error,
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user