fix(start-work): reuse registered opencode agent names

This commit is contained in:
YeonGyu-Kim
2026-04-08 16:18:26 +09:00
parent 24629643f0
commit 06b825dd74
13 changed files with 82 additions and 34 deletions
+8 -6
View File
@@ -1,8 +1,12 @@
import type { PluginInput } from "@opencode-ai/plugin"
import { isGptModel, isGpt5_4Model } from "../../agents/types"
import { getSessionAgent, updateSessionAgent } from "../../features/claude-code-session-state"
import {
getSessionAgent,
resolveRegisteredAgentName,
updateSessionAgent,
} from "../../features/claude-code-session-state"
import { log } from "../../shared"
import { getAgentConfigKey, getAgentDisplayName } from "../../shared/agent-display-names"
import { getAgentConfigKey } from "../../shared/agent-display-names"
const TOAST_TITLE = "NEVER Use Sisyphus with GPT"
const TOAST_MESSAGE = [
@@ -10,8 +14,6 @@ const TOAST_MESSAGE = [
"Do NOT use Sisyphus with GPT (except GPT-5.4 which has specialized support).",
"For GPT models (other than 5.4), always use Hephaestus.",
].join("\n")
const HEPHAESTUS_DISPLAY = getAgentDisplayName("hephaestus")
function showToast(ctx: PluginInput, sessionID: string): void {
ctx.client.tui.showToast({
body: {
@@ -43,9 +45,9 @@ export function createNoSisyphusGptHook(ctx: PluginInput) {
if (agentKey === "sisyphus" && modelID && isGptModel(modelID) && !isGpt5_4Model(modelID)) {
showToast(ctx, input.sessionID)
input.agent = "hephaestus"
input.agent = resolveRegisteredAgentName("hephaestus") ?? "hephaestus"
if (output?.message) {
output.message.agent = "hephaestus"
output.message.agent = resolveRegisteredAgentName("hephaestus") ?? "hephaestus"
}
updateSessionAgent(input.sessionID, "hephaestus")
}