feat(plugin): wire team-mode into tool-guard and transform hook creation
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
createJsonErrorRecoveryHook,
|
||||
createTodoDescriptionOverrideHook,
|
||||
createWebFetchRedirectGuardHook,
|
||||
createTeamToolGating,
|
||||
} from "../../hooks"
|
||||
import {
|
||||
getOpenCodeVersion,
|
||||
@@ -41,6 +42,7 @@ export type ToolGuardHooks = {
|
||||
readImageResizer: ReturnType<typeof createReadImageResizerHook> | null
|
||||
todoDescriptionOverride: ReturnType<typeof createTodoDescriptionOverrideHook> | null
|
||||
webfetchRedirectGuard: ReturnType<typeof createWebFetchRedirectGuardHook> | null
|
||||
teamToolGating: ReturnType<typeof createTeamToolGating> | 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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<typeof createClaudeCodeHooksHook> | null
|
||||
keywordDetector: ReturnType<typeof createKeywordDetectorHook> | null
|
||||
contextInjectorMessagesTransform: ReturnType<typeof createContextInjectorMessagesTransformHook>
|
||||
teamModeStatusInjector: ReturnType<typeof createTeamModeStatusInjector> | null
|
||||
teamMailboxInjector: ReturnType<typeof createTeamMailboxInjector> | null
|
||||
thinkingBlockValidator: ReturnType<typeof createThinkingBlockValidatorHook> | null
|
||||
toolPairValidator: ReturnType<typeof createToolPairValidatorHook> | 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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user