diff --git a/src/config/schema/hooks.ts b/src/config/schema/hooks.ts index f4b5a987..bb5f6bdb 100644 --- a/src/config/schema/hooks.ts +++ b/src/config/schema/hooks.ts @@ -2,7 +2,6 @@ import { z } from "zod" export const HookNameSchema = z.enum([ "todo-continuation-enforcer", - "task-continuation-enforcer", "context-window-monitor", "session-recovery", "session-notification", diff --git a/src/hooks/interactive-bash-session/index.ts b/src/hooks/interactive-bash-session/index.ts index 22b925ff..50c5cebc 100644 --- a/src/hooks/interactive-bash-session/index.ts +++ b/src/hooks/interactive-bash-session/index.ts @@ -1,3 +1,3 @@ -export { createInteractiveBashSessionHook } from "./interactive-bash-session-hook" +export { createInteractiveBashSessionHook } from "./hook" export { createInteractiveBashSessionTracker } from "./interactive-bash-session-tracker" export { parseTmuxCommand } from "./tmux-command-parser" diff --git a/src/plugin-handlers/config-handler.test.ts b/src/plugin-handlers/config-handler.test.ts index 62b5140a..bca4ce4d 100644 --- a/src/plugin-handlers/config-handler.test.ts +++ b/src/plugin-handlers/config-handler.test.ts @@ -1,4 +1,4 @@ -/// +/// import { describe, test, expect, spyOn, beforeEach, afterEach } from "bun:test" import { resolveCategoryConfig, createConfigHandler } from "./config-handler" diff --git a/src/plugin/event.ts b/src/plugin/event.ts index 21f458f1..4c068503 100644 --- a/src/plugin/event.ts +++ b/src/plugin/event.ts @@ -33,7 +33,6 @@ export function createEventHandler(args: { await Promise.resolve(hooks.backgroundNotificationHook?.event?.(input)) await Promise.resolve(hooks.sessionNotification?.(input)) await Promise.resolve(hooks.todoContinuationEnforcer?.handler?.(input)) - await Promise.resolve(hooks.taskContinuationEnforcer?.handler?.(input)) await Promise.resolve(hooks.unstableAgentBabysitter?.event?.(input)) await Promise.resolve(hooks.contextWindowMonitor?.event?.(input)) await Promise.resolve(hooks.directoryAgentsInjector?.event?.(input)) diff --git a/src/plugin/hooks/create-continuation-hooks.ts b/src/plugin/hooks/create-continuation-hooks.ts index 4db6d33b..dbc2d3d0 100644 --- a/src/plugin/hooks/create-continuation-hooks.ts +++ b/src/plugin/hooks/create-continuation-hooks.ts @@ -4,7 +4,6 @@ import type { PluginContext } from "../types" import { createTodoContinuationEnforcer, - createTaskContinuationEnforcer, createBackgroundNotificationHook, createStopContinuationGuardHook, createCompactionContextInjector, @@ -19,7 +18,6 @@ export type ContinuationHooks = { compactionContextInjector: ReturnType | null compactionTodoPreserver: ReturnType | null todoContinuationEnforcer: ReturnType | null - taskContinuationEnforcer: ReturnType | null unstableAgentBabysitter: ReturnType | null backgroundNotificationHook: ReturnType | null atlasHook: ReturnType | null @@ -70,14 +68,6 @@ export function createContinuationHooks(args: { })) : null - const taskContinuationEnforcer = isHookEnabled("task-continuation-enforcer") - ? safeHook("task-continuation-enforcer", () => - createTaskContinuationEnforcer(ctx, pluginConfig, { - backgroundManager, - isContinuationStopped: stopContinuationGuard?.isStopped, - })) - : null - const unstableAgentBabysitter = isHookEnabled("unstable-agent-babysitter") ? safeHook("unstable-agent-babysitter", () => createUnstableAgentBabysitter({ ctx, backgroundManager, pluginConfig })) @@ -91,10 +81,7 @@ export function createContinuationHooks(args: { onAbortCallbacks.push(todoContinuationEnforcer.markRecovering) onRecoveryCompleteCallbacks.push(todoContinuationEnforcer.markRecoveryComplete) } - if (taskContinuationEnforcer) { - onAbortCallbacks.push(taskContinuationEnforcer.markRecovering) - onRecoveryCompleteCallbacks.push(taskContinuationEnforcer.markRecoveryComplete) - } + if (onAbortCallbacks.length > 0) { sessionRecovery.setOnAbortCallback((sessionID: string) => { @@ -129,7 +116,6 @@ export function createContinuationHooks(args: { compactionContextInjector, compactionTodoPreserver, todoContinuationEnforcer, - taskContinuationEnforcer, unstableAgentBabysitter, backgroundNotificationHook, atlasHook, diff --git a/src/plugin/tool-execute-before.ts b/src/plugin/tool-execute-before.ts index 0af9605a..c7fefb0a 100644 --- a/src/plugin/tool-execute-before.ts +++ b/src/plugin/tool-execute-before.ts @@ -88,7 +88,6 @@ export function createToolExecuteBeforeHandler(args: { if (command === "stop-continuation" && sessionID) { hooks.stopContinuationGuard?.stop(sessionID) hooks.todoContinuationEnforcer?.cancelAllCountdowns() - hooks.taskContinuationEnforcer?.cancelAllCountdowns() hooks.ralphLoop?.cancelLoop(sessionID) clearBoulderState(ctx.directory) log("[stop-continuation] All continuation mechanisms stopped", { diff --git a/src/tools/call-omo-agent/tools.ts b/src/tools/call-omo-agent/tools.ts index 242b4d5c..dbcfcf97 100644 --- a/src/tools/call-omo-agent/tools.ts +++ b/src/tools/call-omo-agent/tools.ts @@ -1,12 +1,10 @@ import { tool, type PluginInput, type ToolDefinition } from "@opencode-ai/plugin" import { ALLOWED_AGENTS, CALL_OMO_AGENT_DESCRIPTION } from "./constants" -import type { CallOmoAgentArgs } from "./types" +import type { AllowedAgentType, CallOmoAgentArgs, ToolContextWithMetadata } from "./types" import type { BackgroundManager } from "../../features/background-agent" import { log } from "../../shared" -import { normalizeAgentType } from "./agent-type-normalizer" -import { executeBackgroundAgent } from "./background-agent-executor" -import { executeSyncAgent } from "./sync-agent-executor" -import type { ToolContextWithMetadata } from "./tool-context-with-metadata" +import { executeBackground } from "./background-executor" +import { executeSync } from "./sync-executor" export function createCallOmoAgent( ctx: PluginInput, @@ -34,21 +32,26 @@ export function createCallOmoAgent( const toolCtx = toolContext as ToolContextWithMetadata log(`[call_omo_agent] Starting with agent: ${args.subagent_type}, background: ${args.run_in_background}`) - const normalizedAgent = normalizeAgentType(args.subagent_type) - if (!normalizedAgent) { + // Case-insensitive agent validation - allows "Explore", "EXPLORE", "explore" etc. + if ( + !ALLOWED_AGENTS.some( + (name) => name.toLowerCase() === args.subagent_type.toLowerCase(), + ) + ) { return `Error: Invalid agent type "${args.subagent_type}". Only ${ALLOWED_AGENTS.join(", ")} are allowed.` } + const normalizedAgent = args.subagent_type.toLowerCase() as AllowedAgentType args = { ...args, subagent_type: normalizedAgent } if (args.run_in_background) { if (args.session_id) { return `Error: session_id is not supported in background mode. Use run_in_background=false to continue an existing session.` } - return await executeBackgroundAgent(args, toolCtx, backgroundManager) + return await executeBackground(args, toolCtx, backgroundManager) } - return await executeSyncAgent(args, toolCtx, ctx) + return await executeSync(args, toolCtx, ctx) }, }) } diff --git a/src/tools/delegate-task/executor.ts b/src/tools/delegate-task/executor.ts index ec63771c..927ea41b 100644 --- a/src/tools/delegate-task/executor.ts +++ b/src/tools/delegate-task/executor.ts @@ -1,6 +1,6 @@ export type { ExecutorContext, ParentContext } from "./executor-types" -export { resolveSkillContent } from "./skill-content-resolver" +export { resolveSkillContent } from "./skill-resolver" export { resolveParentContext } from "./parent-context-resolver" export { executeBackgroundContinuation } from "./background-continuation"