2026-02-17 23:33:24 +09:00
|
|
|
import type { PluginInput } from "@opencode-ai/plugin"
|
2026-03-06 17:35:31 +09:00
|
|
|
import { isGptModel, isGpt5_4Model } from "../../agents/types"
|
2026-04-08 16:18:26 +09:00
|
|
|
import {
|
|
|
|
|
getSessionAgent,
|
|
|
|
|
resolveRegisteredAgentName,
|
|
|
|
|
updateSessionAgent,
|
|
|
|
|
} from "../../features/claude-code-session-state"
|
2026-02-17 23:33:24 +09:00
|
|
|
import { log } from "../../shared"
|
2026-04-08 16:18:26 +09:00
|
|
|
import { getAgentConfigKey } from "../../shared/agent-display-names"
|
2026-02-17 23:33:24 +09:00
|
|
|
|
2026-02-18 16:26:47 +09:00
|
|
|
const TOAST_TITLE = "NEVER Use Sisyphus with GPT"
|
|
|
|
|
const TOAST_MESSAGE = [
|
2026-02-20 10:44:23 +09:00
|
|
|
"Sisyphus works best with Claude Opus, and works fine with Kimi/GLM models.",
|
2026-03-06 17:35:31 +09:00
|
|
|
"Do NOT use Sisyphus with GPT (except GPT-5.4 which has specialized support).",
|
|
|
|
|
"For GPT models (other than 5.4), always use Hephaestus.",
|
2026-02-18 16:26:47 +09:00
|
|
|
].join("\n")
|
|
|
|
|
function showToast(ctx: PluginInput, sessionID: string): void {
|
|
|
|
|
ctx.client.tui.showToast({
|
|
|
|
|
body: {
|
|
|
|
|
title: TOAST_TITLE,
|
|
|
|
|
message: TOAST_MESSAGE,
|
|
|
|
|
variant: "error",
|
|
|
|
|
duration: 10000,
|
|
|
|
|
},
|
|
|
|
|
}).catch((error) => {
|
2026-02-18 16:33:16 +09:00
|
|
|
log("[no-sisyphus-gpt] Failed to show toast", {
|
2026-02-18 16:26:47 +09:00
|
|
|
sessionID,
|
|
|
|
|
error,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
2026-02-17 23:33:24 +09:00
|
|
|
|
2026-02-18 16:33:16 +09:00
|
|
|
export function createNoSisyphusGptHook(ctx: PluginInput) {
|
2026-02-17 23:33:24 +09:00
|
|
|
return {
|
|
|
|
|
"chat.message": async (input: {
|
|
|
|
|
sessionID: string
|
|
|
|
|
agent?: string
|
|
|
|
|
model?: { providerID: string; modelID: string }
|
2026-02-18 16:33:16 +09:00
|
|
|
}, output?: {
|
|
|
|
|
message?: { agent?: string; [key: string]: unknown }
|
2026-02-17 23:33:24 +09:00
|
|
|
}): Promise<void> => {
|
2026-02-18 16:26:47 +09:00
|
|
|
const rawAgent = input.agent ?? getSessionAgent(input.sessionID) ?? ""
|
|
|
|
|
const agentKey = getAgentConfigKey(rawAgent)
|
|
|
|
|
const modelID = input.model?.modelID
|
2026-02-17 23:33:24 +09:00
|
|
|
|
2026-03-06 17:35:31 +09:00
|
|
|
if (agentKey === "sisyphus" && modelID && isGptModel(modelID) && !isGpt5_4Model(modelID)) {
|
2026-02-18 16:26:47 +09:00
|
|
|
showToast(ctx, input.sessionID)
|
2026-04-08 16:18:26 +09:00
|
|
|
input.agent = resolveRegisteredAgentName("hephaestus") ?? "hephaestus"
|
2026-02-18 16:33:16 +09:00
|
|
|
if (output?.message) {
|
2026-04-08 16:18:26 +09:00
|
|
|
output.message.agent = resolveRegisteredAgentName("hephaestus") ?? "hephaestus"
|
2026-02-18 16:33:16 +09:00
|
|
|
}
|
2026-04-07 10:08:04 +09:00
|
|
|
updateSessionAgent(input.sessionID, "hephaestus")
|
2026-02-17 23:33:24 +09:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|