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:
YeonGyu-Kim
2026-02-17 23:33:24 +09:00
parent eaf315a8d7
commit 0bffdc441e
8 changed files with 127 additions and 0 deletions
+1
View File
@@ -27,6 +27,7 @@ export { createInteractiveBashSessionHook } from "./interactive-bash-session";
export { createThinkingBlockValidatorHook } from "./thinking-block-validator";
export { createCategorySkillReminderHook } from "./category-skill-reminder";
export { createRalphLoopHook, type RalphLoopHook } from "./ralph-loop";
export { createSisyphusGptHephaestusReminderHook } from "./sisyphus-gpt-hephaestus-reminder";
export { createAutoSlashCommandHook } from "./auto-slash-command";
export { createEditErrorRecoveryHook } from "./edit-error-recovery";
export { createJsonErrorRecoveryHook } from "./json-error-recovery";
@@ -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,
})
})
},
}
}
@@ -0,0 +1,78 @@
import { describe, expect, test, spyOn } from "bun:test"
import { createSisyphusGptHephaestusReminderHook } from "./index"
import { _resetForTesting, updateSessionAgent } from "../../features/claude-code-session-state"
describe("sisyphus-gpt-hephaestus-reminder hook", () => {
test("shows error toast when sisyphus uses gpt model", async () => {
// given - sisyphus agent with gpt model
const showToast = spyOn({
fn: async () => ({}),
}, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
client: {
tui: { showToast },
},
} as any)
// when - chat.message runs
await hook["chat.message"]?.({
sessionID: "ses_1",
agent: "sisyphus",
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
})
// then - error toast is shown
expect(showToast).toHaveBeenCalledTimes(1)
expect(showToast.mock.calls[0]?.[0]).toMatchObject({
body: {
title: "Use Hephaestus for GPT Models",
variant: "error",
},
})
})
test("does not show toast for non-gpt model", async () => {
// given - sisyphus agent with non-gpt model
const showToast = spyOn({
fn: async () => ({}),
}, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
client: {
tui: { showToast },
},
} as any)
// when - chat.message runs with claude model
await hook["chat.message"]?.({
sessionID: "ses_2",
agent: "sisyphus",
model: { providerID: "anthropic", modelID: "claude-opus-4-6" },
})
// then - no toast
expect(showToast).toHaveBeenCalledTimes(0)
})
test("uses session agent fallback when input agent is missing", async () => {
// given - session agent saved as sisyphus
_resetForTesting()
updateSessionAgent("ses_3", "sisyphus")
const showToast = spyOn({
fn: async () => ({}),
}, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
client: {
tui: { showToast },
},
} as any)
// when - chat.message runs without input.agent
await hook["chat.message"]?.({
sessionID: "ses_3",
model: { providerID: "openai", modelID: "gpt-5.2" },
})
// then - toast shown via fallback agent lookup
expect(showToast).toHaveBeenCalledTimes(1)
})
})
@@ -0,0 +1 @@
export { createSisyphusGptHephaestusReminderHook } from "./hook"