From 20a66f7061ccd1904f582d20f52d3e125b74f1d3 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Tue, 28 Apr 2026 10:48:45 +0900 Subject: [PATCH] feat(plugin): wire team-mode into tool-guard and transform hook creation --- src/plugin/hooks/create-tool-guard-hooks.ts | 7 ++++++ src/plugin/hooks/create-transform-hooks.ts | 24 +++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/plugin/hooks/create-tool-guard-hooks.ts b/src/plugin/hooks/create-tool-guard-hooks.ts index 01b671e6b..8f6675350 100644 --- a/src/plugin/hooks/create-tool-guard-hooks.ts +++ b/src/plugin/hooks/create-tool-guard-hooks.ts @@ -17,6 +17,7 @@ import { createJsonErrorRecoveryHook, createTodoDescriptionOverrideHook, createWebFetchRedirectGuardHook, + createTeamToolGating, } from "../../hooks" import { getOpenCodeVersion, @@ -41,6 +42,7 @@ export type ToolGuardHooks = { readImageResizer: ReturnType | null todoDescriptionOverride: ReturnType | null webfetchRedirectGuard: ReturnType | null + teamToolGating: ReturnType | null } export function createToolGuardHooks(args: { @@ -133,6 +135,10 @@ export function createToolGuardHooks(args: { ? safeHook("webfetch-redirect-guard", () => createWebFetchRedirectGuardHook(ctx)) : null + const teamToolGating = isHookEnabled("team-tool-gating") + ? safeHook("team-tool-gating", () => createTeamToolGating(ctx, pluginConfig.team_mode)) + : null + return { commentChecker, toolOutputTruncator, @@ -148,5 +154,6 @@ export function createToolGuardHooks(args: { readImageResizer, todoDescriptionOverride, webfetchRedirectGuard, + teamToolGating, } } diff --git a/src/plugin/hooks/create-transform-hooks.ts b/src/plugin/hooks/create-transform-hooks.ts index 7d107571b..966600f21 100644 --- a/src/plugin/hooks/create-transform-hooks.ts +++ b/src/plugin/hooks/create-transform-hooks.ts @@ -5,6 +5,8 @@ import type { RalphLoopHook } from "../../hooks/ralph-loop" import { createClaudeCodeHooksHook, createKeywordDetectorHook, + createTeamMailboxInjector, + createTeamModeStatusInjector, createThinkingBlockValidatorHook, createToolPairValidatorHook, } from "../../hooks" @@ -18,6 +20,8 @@ export type TransformHooks = { claudeCodeHooks: ReturnType | null keywordDetector: ReturnType | null contextInjectorMessagesTransform: ReturnType + teamModeStatusInjector: ReturnType | null + teamMailboxInjector: ReturnType | null thinkingBlockValidator: ReturnType | null toolPairValidator: ReturnType | null } @@ -59,6 +63,24 @@ export function createTransformHooks(args: { const contextInjectorMessagesTransform = createContextInjectorMessagesTransformHook(contextCollector) + const teamModeConfig = pluginConfig.team_mode + + const teamModeStatusInjector = teamModeConfig?.enabled + ? safeCreateHook( + "team-mode-status-injector", + () => createTeamModeStatusInjector(teamModeConfig), + { enabled: safeHookEnabled }, + ) + : null + + const teamMailboxInjector = teamModeConfig?.enabled + ? safeCreateHook( + "team-mailbox-injector", + () => createTeamMailboxInjector(ctx, teamModeConfig), + { enabled: safeHookEnabled }, + ) + : null + const thinkingBlockValidator = isHookEnabled("thinking-block-validator") ? safeCreateHook( "thinking-block-validator", @@ -79,6 +101,8 @@ export function createTransformHooks(args: { claudeCodeHooks, keywordDetector, contextInjectorMessagesTransform, + teamModeStatusInjector, + teamMailboxInjector, thinkingBlockValidator, toolPairValidator, }