refactor(hooks): rename sisyphus-gpt-hephaestus-reminder to no-sisyphus-gpt
Shorter hook name, disableable via disabled_hooks config, migration added for backward compatibility. Also forces agent switch to Hephaestus on Sisyphus + GPT detection. Docs updated with new hook name.
This commit is contained in:
parent
a49e05fd56
commit
a60a153d19
@ -91,7 +91,7 @@
|
|||||||
"delegate-task-retry",
|
"delegate-task-retry",
|
||||||
"prometheus-md-only",
|
"prometheus-md-only",
|
||||||
"sisyphus-junior-notepad",
|
"sisyphus-junior-notepad",
|
||||||
"sisyphus-gpt-hephaestus-reminder",
|
"no-sisyphus-gpt",
|
||||||
"start-work",
|
"start-work",
|
||||||
"atlas",
|
"atlas",
|
||||||
"unstable-agent-babysitter",
|
"unstable-agent-babysitter",
|
||||||
|
|||||||
@ -973,7 +973,7 @@ Disable specific built-in hooks via `disabled_hooks` in `~/.config/opencode/oh-m
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Available hooks: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`, `preemptive-compaction`, `auto-slash-command`, `sisyphus-junior-notepad`, `start-work`
|
Available hooks: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`, `preemptive-compaction`, `auto-slash-command`, `sisyphus-junior-notepad`, `no-sisyphus-gpt`, `start-work`
|
||||||
|
|
||||||
**Note on `directory-agents-injector`**: This hook is **automatically disabled** when running on OpenCode 1.1.37+ because OpenCode now has native support for dynamically resolving AGENTS.md files from subdirectories (PR #10678). This prevents duplicate AGENTS.md injection. For older OpenCode versions, the hook remains active to provide the same functionality.
|
**Note on `directory-agents-injector`**: This hook is **automatically disabled** when running on OpenCode 1.1.37+ because OpenCode now has native support for dynamically resolving AGENTS.md files from subdirectories (PR #10678). This prevents duplicate AGENTS.md injection. For older OpenCode versions, the hook remains active to provide the same functionality.
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export const HookNameSchema = z.enum([
|
|||||||
"delegate-task-retry",
|
"delegate-task-retry",
|
||||||
"prometheus-md-only",
|
"prometheus-md-only",
|
||||||
"sisyphus-junior-notepad",
|
"sisyphus-junior-notepad",
|
||||||
"sisyphus-gpt-hephaestus-reminder",
|
"no-sisyphus-gpt",
|
||||||
"start-work",
|
"start-work",
|
||||||
"atlas",
|
"atlas",
|
||||||
"unstable-agent-babysitter",
|
"unstable-agent-babysitter",
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export { createInteractiveBashSessionHook } from "./interactive-bash-session";
|
|||||||
export { createThinkingBlockValidatorHook } from "./thinking-block-validator";
|
export { createThinkingBlockValidatorHook } from "./thinking-block-validator";
|
||||||
export { createCategorySkillReminderHook } from "./category-skill-reminder";
|
export { createCategorySkillReminderHook } from "./category-skill-reminder";
|
||||||
export { createRalphLoopHook, type RalphLoopHook } from "./ralph-loop";
|
export { createRalphLoopHook, type RalphLoopHook } from "./ralph-loop";
|
||||||
export { createSisyphusGptHephaestusReminderHook } from "./sisyphus-gpt-hephaestus-reminder";
|
export { createNoSisyphusGptHook } from "./no-sisyphus-gpt";
|
||||||
export { createAutoSlashCommandHook } from "./auto-slash-command";
|
export { createAutoSlashCommandHook } from "./auto-slash-command";
|
||||||
export { createEditErrorRecoveryHook } from "./edit-error-recovery";
|
export { createEditErrorRecoveryHook } from "./edit-error-recovery";
|
||||||
export { createJsonErrorRecoveryHook } from "./json-error-recovery";
|
export { createJsonErrorRecoveryHook } from "./json-error-recovery";
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import type { PluginInput } from "@opencode-ai/plugin"
|
import type { PluginInput } from "@opencode-ai/plugin"
|
||||||
import { isGptModel } from "../../agents/types"
|
import { isGptModel } from "../../agents/types"
|
||||||
import { getSessionAgent } from "../../features/claude-code-session-state"
|
import { getSessionAgent, updateSessionAgent } from "../../features/claude-code-session-state"
|
||||||
import { log } from "../../shared"
|
import { log } from "../../shared"
|
||||||
import { getAgentConfigKey } from "../../shared/agent-display-names"
|
import { getAgentConfigKey, getAgentDisplayName } from "../../shared/agent-display-names"
|
||||||
|
|
||||||
const TOAST_TITLE = "NEVER Use Sisyphus with GPT"
|
const TOAST_TITLE = "NEVER Use Sisyphus with GPT"
|
||||||
const TOAST_MESSAGE = [
|
const TOAST_MESSAGE = [
|
||||||
@ -11,6 +11,7 @@ const TOAST_MESSAGE = [
|
|||||||
"You are literally burning money.",
|
"You are literally burning money.",
|
||||||
"Use Hephaestus for GPT models instead.",
|
"Use Hephaestus for GPT models instead.",
|
||||||
].join("\n")
|
].join("\n")
|
||||||
|
const HEPHAESTUS_DISPLAY = getAgentDisplayName("hephaestus")
|
||||||
|
|
||||||
function showToast(ctx: PluginInput, sessionID: string): void {
|
function showToast(ctx: PluginInput, sessionID: string): void {
|
||||||
ctx.client.tui.showToast({
|
ctx.client.tui.showToast({
|
||||||
@ -21,19 +22,21 @@ function showToast(ctx: PluginInput, sessionID: string): void {
|
|||||||
duration: 10000,
|
duration: 10000,
|
||||||
},
|
},
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
log("[sisyphus-gpt-hephaestus-reminder] Failed to show toast", {
|
log("[no-sisyphus-gpt] Failed to show toast", {
|
||||||
sessionID,
|
sessionID,
|
||||||
error,
|
error,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createSisyphusGptHephaestusReminderHook(ctx: PluginInput) {
|
export function createNoSisyphusGptHook(ctx: PluginInput) {
|
||||||
return {
|
return {
|
||||||
"chat.message": async (input: {
|
"chat.message": async (input: {
|
||||||
sessionID: string
|
sessionID: string
|
||||||
agent?: string
|
agent?: string
|
||||||
model?: { providerID: string; modelID: string }
|
model?: { providerID: string; modelID: string }
|
||||||
|
}, output?: {
|
||||||
|
message?: { agent?: string; [key: string]: unknown }
|
||||||
}): Promise<void> => {
|
}): Promise<void> => {
|
||||||
const rawAgent = input.agent ?? getSessionAgent(input.sessionID) ?? ""
|
const rawAgent = input.agent ?? getSessionAgent(input.sessionID) ?? ""
|
||||||
const agentKey = getAgentConfigKey(rawAgent)
|
const agentKey = getAgentConfigKey(rawAgent)
|
||||||
@ -41,6 +44,11 @@ export function createSisyphusGptHephaestusReminderHook(ctx: PluginInput) {
|
|||||||
|
|
||||||
if (agentKey === "sisyphus" && modelID && isGptModel(modelID)) {
|
if (agentKey === "sisyphus" && modelID && isGptModel(modelID)) {
|
||||||
showToast(ctx, input.sessionID)
|
showToast(ctx, input.sessionID)
|
||||||
|
input.agent = HEPHAESTUS_DISPLAY
|
||||||
|
if (output?.message) {
|
||||||
|
output.message.agent = HEPHAESTUS_DISPLAY
|
||||||
|
}
|
||||||
|
updateSessionAgent(input.sessionID, HEPHAESTUS_DISPLAY)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -1,33 +1,45 @@
|
|||||||
import { describe, expect, spyOn, test } from "bun:test"
|
import { describe, expect, spyOn, test } from "bun:test"
|
||||||
import { _resetForTesting, updateSessionAgent } from "../../features/claude-code-session-state"
|
import { _resetForTesting, updateSessionAgent } from "../../features/claude-code-session-state"
|
||||||
import { getAgentDisplayName } from "../../shared/agent-display-names"
|
import { getAgentDisplayName } from "../../shared/agent-display-names"
|
||||||
import { createSisyphusGptHephaestusReminderHook } from "./index"
|
import { createNoSisyphusGptHook } from "./index"
|
||||||
|
|
||||||
const SISYPHUS_DISPLAY = getAgentDisplayName("sisyphus")
|
const SISYPHUS_DISPLAY = getAgentDisplayName("sisyphus")
|
||||||
const HEPHAESTUS_DISPLAY = getAgentDisplayName("hephaestus")
|
const HEPHAESTUS_DISPLAY = getAgentDisplayName("hephaestus")
|
||||||
|
|
||||||
describe("sisyphus-gpt-hephaestus-reminder hook", () => {
|
function createOutput() {
|
||||||
|
return {
|
||||||
|
message: {},
|
||||||
|
parts: [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe("no-sisyphus-gpt hook", () => {
|
||||||
test("shows toast on every chat.message when sisyphus uses gpt model", async () => {
|
test("shows toast on every chat.message when sisyphus uses gpt model", async () => {
|
||||||
// given - sisyphus (display name) with gpt model
|
// given - sisyphus (display name) with gpt model
|
||||||
const showToast = spyOn({ fn: async () => ({}) }, "fn")
|
const showToast = spyOn({ fn: async () => ({}) }, "fn")
|
||||||
const hook = createSisyphusGptHephaestusReminderHook({
|
const hook = createNoSisyphusGptHook({
|
||||||
client: { tui: { showToast } },
|
client: { tui: { showToast } },
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
|
const output1 = createOutput()
|
||||||
|
const output2 = createOutput()
|
||||||
|
|
||||||
// when - chat.message is called repeatedly with display name
|
// when - chat.message is called repeatedly with display name
|
||||||
await hook["chat.message"]?.({
|
await hook["chat.message"]?.({
|
||||||
sessionID: "ses_1",
|
sessionID: "ses_1",
|
||||||
agent: SISYPHUS_DISPLAY,
|
agent: SISYPHUS_DISPLAY,
|
||||||
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
|
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
|
||||||
})
|
}, output1)
|
||||||
await hook["chat.message"]?.({
|
await hook["chat.message"]?.({
|
||||||
sessionID: "ses_1",
|
sessionID: "ses_1",
|
||||||
agent: SISYPHUS_DISPLAY,
|
agent: SISYPHUS_DISPLAY,
|
||||||
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
|
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
|
||||||
})
|
}, output2)
|
||||||
|
|
||||||
// then - toast is shown for every message
|
// then - toast is shown for every message
|
||||||
expect(showToast).toHaveBeenCalledTimes(2)
|
expect(showToast).toHaveBeenCalledTimes(2)
|
||||||
|
expect(output1.message.agent).toBe(HEPHAESTUS_DISPLAY)
|
||||||
|
expect(output2.message.agent).toBe(HEPHAESTUS_DISPLAY)
|
||||||
expect(showToast.mock.calls[0]?.[0]).toMatchObject({
|
expect(showToast.mock.calls[0]?.[0]).toMatchObject({
|
||||||
body: {
|
body: {
|
||||||
title: "NEVER Use Sisyphus with GPT",
|
title: "NEVER Use Sisyphus with GPT",
|
||||||
@ -40,37 +52,43 @@ describe("sisyphus-gpt-hephaestus-reminder hook", () => {
|
|||||||
test("does not show toast for non-gpt model", async () => {
|
test("does not show toast for non-gpt model", async () => {
|
||||||
// given - sisyphus with claude model
|
// given - sisyphus with claude model
|
||||||
const showToast = spyOn({ fn: async () => ({}) }, "fn")
|
const showToast = spyOn({ fn: async () => ({}) }, "fn")
|
||||||
const hook = createSisyphusGptHephaestusReminderHook({
|
const hook = createNoSisyphusGptHook({
|
||||||
client: { tui: { showToast } },
|
client: { tui: { showToast } },
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
|
const output = createOutput()
|
||||||
|
|
||||||
// when - chat.message runs
|
// when - chat.message runs
|
||||||
await hook["chat.message"]?.({
|
await hook["chat.message"]?.({
|
||||||
sessionID: "ses_2",
|
sessionID: "ses_2",
|
||||||
agent: SISYPHUS_DISPLAY,
|
agent: SISYPHUS_DISPLAY,
|
||||||
model: { providerID: "anthropic", modelID: "claude-opus-4-6" },
|
model: { providerID: "anthropic", modelID: "claude-opus-4-6" },
|
||||||
})
|
}, output)
|
||||||
|
|
||||||
// then - no toast
|
// then - no toast
|
||||||
expect(showToast).toHaveBeenCalledTimes(0)
|
expect(showToast).toHaveBeenCalledTimes(0)
|
||||||
|
expect(output.message.agent).toBeUndefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("does not show toast for non-sisyphus agent", async () => {
|
test("does not show toast for non-sisyphus agent", async () => {
|
||||||
// given - hephaestus with gpt model
|
// given - hephaestus with gpt model
|
||||||
const showToast = spyOn({ fn: async () => ({}) }, "fn")
|
const showToast = spyOn({ fn: async () => ({}) }, "fn")
|
||||||
const hook = createSisyphusGptHephaestusReminderHook({
|
const hook = createNoSisyphusGptHook({
|
||||||
client: { tui: { showToast } },
|
client: { tui: { showToast } },
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
|
const output = createOutput()
|
||||||
|
|
||||||
// when - chat.message runs
|
// when - chat.message runs
|
||||||
await hook["chat.message"]?.({
|
await hook["chat.message"]?.({
|
||||||
sessionID: "ses_3",
|
sessionID: "ses_3",
|
||||||
agent: HEPHAESTUS_DISPLAY,
|
agent: HEPHAESTUS_DISPLAY,
|
||||||
model: { providerID: "openai", modelID: "gpt-5.2" },
|
model: { providerID: "openai", modelID: "gpt-5.2" },
|
||||||
})
|
}, output)
|
||||||
|
|
||||||
// then - no toast
|
// then - no toast
|
||||||
expect(showToast).toHaveBeenCalledTimes(0)
|
expect(showToast).toHaveBeenCalledTimes(0)
|
||||||
|
expect(output.message.agent).toBeUndefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("uses session agent fallback when input agent is missing", async () => {
|
test("uses session agent fallback when input agent is missing", async () => {
|
||||||
@ -78,17 +96,20 @@ describe("sisyphus-gpt-hephaestus-reminder hook", () => {
|
|||||||
_resetForTesting()
|
_resetForTesting()
|
||||||
updateSessionAgent("ses_4", SISYPHUS_DISPLAY)
|
updateSessionAgent("ses_4", SISYPHUS_DISPLAY)
|
||||||
const showToast = spyOn({ fn: async () => ({}) }, "fn")
|
const showToast = spyOn({ fn: async () => ({}) }, "fn")
|
||||||
const hook = createSisyphusGptHephaestusReminderHook({
|
const hook = createNoSisyphusGptHook({
|
||||||
client: { tui: { showToast } },
|
client: { tui: { showToast } },
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
|
const output = createOutput()
|
||||||
|
|
||||||
// when - chat.message runs without input.agent
|
// when - chat.message runs without input.agent
|
||||||
await hook["chat.message"]?.({
|
await hook["chat.message"]?.({
|
||||||
sessionID: "ses_4",
|
sessionID: "ses_4",
|
||||||
model: { providerID: "openai", modelID: "gpt-5.2" },
|
model: { providerID: "openai", modelID: "gpt-5.2" },
|
||||||
})
|
}, output)
|
||||||
|
|
||||||
// then - toast shown via session-agent fallback
|
// then - toast shown via session-agent fallback
|
||||||
expect(showToast).toHaveBeenCalledTimes(1)
|
expect(showToast).toHaveBeenCalledTimes(1)
|
||||||
|
expect(output.message.agent).toBe(HEPHAESTUS_DISPLAY)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
1
src/hooks/no-sisyphus-gpt/index.ts
Normal file
1
src/hooks/no-sisyphus-gpt/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { createNoSisyphusGptHook } from "./hook"
|
||||||
@ -1 +0,0 @@
|
|||||||
export { createSisyphusGptHephaestusReminderHook } from "./hook"
|
|
||||||
@ -81,7 +81,7 @@ export function createChatMessageHandler(args: {
|
|||||||
await hooks.keywordDetector?.["chat.message"]?.(input, output)
|
await hooks.keywordDetector?.["chat.message"]?.(input, output)
|
||||||
await hooks.claudeCodeHooks?.["chat.message"]?.(input, output)
|
await hooks.claudeCodeHooks?.["chat.message"]?.(input, output)
|
||||||
await hooks.autoSlashCommand?.["chat.message"]?.(input, output)
|
await hooks.autoSlashCommand?.["chat.message"]?.(input, output)
|
||||||
await hooks.sisyphusGptHephaestusReminder?.["chat.message"]?.(input)
|
await hooks.noSisyphusGpt?.["chat.message"]?.(input, output)
|
||||||
if (hooks.startWork && isStartWorkHookOutput(output)) {
|
if (hooks.startWork && isStartWorkHookOutput(output)) {
|
||||||
await hooks.startWork["chat.message"]?.(input, output)
|
await hooks.startWork["chat.message"]?.(input, output)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import {
|
|||||||
createStartWorkHook,
|
createStartWorkHook,
|
||||||
createPrometheusMdOnlyHook,
|
createPrometheusMdOnlyHook,
|
||||||
createSisyphusJuniorNotepadHook,
|
createSisyphusJuniorNotepadHook,
|
||||||
createSisyphusGptHephaestusReminderHook,
|
createNoSisyphusGptHook,
|
||||||
createQuestionLabelTruncatorHook,
|
createQuestionLabelTruncatorHook,
|
||||||
createPreemptiveCompactionHook,
|
createPreemptiveCompactionHook,
|
||||||
} from "../../hooks"
|
} from "../../hooks"
|
||||||
@ -51,7 +51,7 @@ export type SessionHooks = {
|
|||||||
startWork: ReturnType<typeof createStartWorkHook> | null
|
startWork: ReturnType<typeof createStartWorkHook> | null
|
||||||
prometheusMdOnly: ReturnType<typeof createPrometheusMdOnlyHook> | null
|
prometheusMdOnly: ReturnType<typeof createPrometheusMdOnlyHook> | null
|
||||||
sisyphusJuniorNotepad: ReturnType<typeof createSisyphusJuniorNotepadHook> | null
|
sisyphusJuniorNotepad: ReturnType<typeof createSisyphusJuniorNotepadHook> | null
|
||||||
sisyphusGptHephaestusReminder: ReturnType<typeof createSisyphusGptHephaestusReminderHook> | null
|
noSisyphusGpt: ReturnType<typeof createNoSisyphusGptHook> | null
|
||||||
questionLabelTruncator: ReturnType<typeof createQuestionLabelTruncatorHook>
|
questionLabelTruncator: ReturnType<typeof createQuestionLabelTruncatorHook>
|
||||||
taskResumeInfo: ReturnType<typeof createTaskResumeInfoHook>
|
taskResumeInfo: ReturnType<typeof createTaskResumeInfoHook>
|
||||||
anthropicEffort: ReturnType<typeof createAnthropicEffortHook> | null
|
anthropicEffort: ReturnType<typeof createAnthropicEffortHook> | null
|
||||||
@ -158,8 +158,8 @@ export function createSessionHooks(args: {
|
|||||||
? safeHook("sisyphus-junior-notepad", () => createSisyphusJuniorNotepadHook(ctx))
|
? safeHook("sisyphus-junior-notepad", () => createSisyphusJuniorNotepadHook(ctx))
|
||||||
: null
|
: null
|
||||||
|
|
||||||
const sisyphusGptHephaestusReminder = isHookEnabled("sisyphus-gpt-hephaestus-reminder")
|
const noSisyphusGpt = isHookEnabled("no-sisyphus-gpt")
|
||||||
? safeHook("sisyphus-gpt-hephaestus-reminder", () => createSisyphusGptHephaestusReminderHook(ctx))
|
? safeHook("no-sisyphus-gpt", () => createNoSisyphusGptHook(ctx))
|
||||||
: null
|
: null
|
||||||
|
|
||||||
const questionLabelTruncator = createQuestionLabelTruncatorHook()
|
const questionLabelTruncator = createQuestionLabelTruncatorHook()
|
||||||
@ -187,7 +187,7 @@ export function createSessionHooks(args: {
|
|||||||
startWork,
|
startWork,
|
||||||
prometheusMdOnly,
|
prometheusMdOnly,
|
||||||
sisyphusJuniorNotepad,
|
sisyphusJuniorNotepad,
|
||||||
sisyphusGptHephaestusReminder,
|
noSisyphusGpt,
|
||||||
questionLabelTruncator,
|
questionLabelTruncator,
|
||||||
taskResumeInfo,
|
taskResumeInfo,
|
||||||
anthropicEffort,
|
anthropicEffort,
|
||||||
|
|||||||
@ -5,6 +5,8 @@ export const HOOK_NAME_MAP: Record<string, string | null> = {
|
|||||||
"anthropic-auto-compact": "anthropic-context-window-limit-recovery",
|
"anthropic-auto-compact": "anthropic-context-window-limit-recovery",
|
||||||
"sisyphus-orchestrator": "atlas",
|
"sisyphus-orchestrator": "atlas",
|
||||||
|
|
||||||
|
"sisyphus-gpt-hephaestus-reminder": "no-sisyphus-gpt",
|
||||||
|
|
||||||
// Removed hooks (v3.0.0) - will be filtered out and user warned
|
// Removed hooks (v3.0.0) - will be filtered out and user warned
|
||||||
"empty-message-sanitizer": null,
|
"empty-message-sanitizer": null,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user