feat(plugin): wire team-mode into tool-guard and transform hook creation
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
|||||||
createJsonErrorRecoveryHook,
|
createJsonErrorRecoveryHook,
|
||||||
createTodoDescriptionOverrideHook,
|
createTodoDescriptionOverrideHook,
|
||||||
createWebFetchRedirectGuardHook,
|
createWebFetchRedirectGuardHook,
|
||||||
|
createTeamToolGating,
|
||||||
} from "../../hooks"
|
} from "../../hooks"
|
||||||
import {
|
import {
|
||||||
getOpenCodeVersion,
|
getOpenCodeVersion,
|
||||||
@@ -41,6 +42,7 @@ export type ToolGuardHooks = {
|
|||||||
readImageResizer: ReturnType<typeof createReadImageResizerHook> | null
|
readImageResizer: ReturnType<typeof createReadImageResizerHook> | null
|
||||||
todoDescriptionOverride: ReturnType<typeof createTodoDescriptionOverrideHook> | null
|
todoDescriptionOverride: ReturnType<typeof createTodoDescriptionOverrideHook> | null
|
||||||
webfetchRedirectGuard: ReturnType<typeof createWebFetchRedirectGuardHook> | null
|
webfetchRedirectGuard: ReturnType<typeof createWebFetchRedirectGuardHook> | null
|
||||||
|
teamToolGating: ReturnType<typeof createTeamToolGating> | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createToolGuardHooks(args: {
|
export function createToolGuardHooks(args: {
|
||||||
@@ -133,6 +135,10 @@ export function createToolGuardHooks(args: {
|
|||||||
? safeHook("webfetch-redirect-guard", () => createWebFetchRedirectGuardHook(ctx))
|
? safeHook("webfetch-redirect-guard", () => createWebFetchRedirectGuardHook(ctx))
|
||||||
: null
|
: null
|
||||||
|
|
||||||
|
const teamToolGating = isHookEnabled("team-tool-gating")
|
||||||
|
? safeHook("team-tool-gating", () => createTeamToolGating(ctx, pluginConfig.team_mode))
|
||||||
|
: null
|
||||||
|
|
||||||
return {
|
return {
|
||||||
commentChecker,
|
commentChecker,
|
||||||
toolOutputTruncator,
|
toolOutputTruncator,
|
||||||
@@ -148,5 +154,6 @@ export function createToolGuardHooks(args: {
|
|||||||
readImageResizer,
|
readImageResizer,
|
||||||
todoDescriptionOverride,
|
todoDescriptionOverride,
|
||||||
webfetchRedirectGuard,
|
webfetchRedirectGuard,
|
||||||
|
teamToolGating,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import type { RalphLoopHook } from "../../hooks/ralph-loop"
|
|||||||
import {
|
import {
|
||||||
createClaudeCodeHooksHook,
|
createClaudeCodeHooksHook,
|
||||||
createKeywordDetectorHook,
|
createKeywordDetectorHook,
|
||||||
|
createTeamMailboxInjector,
|
||||||
|
createTeamModeStatusInjector,
|
||||||
createThinkingBlockValidatorHook,
|
createThinkingBlockValidatorHook,
|
||||||
createToolPairValidatorHook,
|
createToolPairValidatorHook,
|
||||||
} from "../../hooks"
|
} from "../../hooks"
|
||||||
@@ -18,6 +20,8 @@ export type TransformHooks = {
|
|||||||
claudeCodeHooks: ReturnType<typeof createClaudeCodeHooksHook> | null
|
claudeCodeHooks: ReturnType<typeof createClaudeCodeHooksHook> | null
|
||||||
keywordDetector: ReturnType<typeof createKeywordDetectorHook> | null
|
keywordDetector: ReturnType<typeof createKeywordDetectorHook> | null
|
||||||
contextInjectorMessagesTransform: ReturnType<typeof createContextInjectorMessagesTransformHook>
|
contextInjectorMessagesTransform: ReturnType<typeof createContextInjectorMessagesTransformHook>
|
||||||
|
teamModeStatusInjector: ReturnType<typeof createTeamModeStatusInjector> | null
|
||||||
|
teamMailboxInjector: ReturnType<typeof createTeamMailboxInjector> | null
|
||||||
thinkingBlockValidator: ReturnType<typeof createThinkingBlockValidatorHook> | null
|
thinkingBlockValidator: ReturnType<typeof createThinkingBlockValidatorHook> | null
|
||||||
toolPairValidator: ReturnType<typeof createToolPairValidatorHook> | null
|
toolPairValidator: ReturnType<typeof createToolPairValidatorHook> | null
|
||||||
}
|
}
|
||||||
@@ -59,6 +63,24 @@ export function createTransformHooks(args: {
|
|||||||
const contextInjectorMessagesTransform =
|
const contextInjectorMessagesTransform =
|
||||||
createContextInjectorMessagesTransformHook(contextCollector)
|
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")
|
const thinkingBlockValidator = isHookEnabled("thinking-block-validator")
|
||||||
? safeCreateHook(
|
? safeCreateHook(
|
||||||
"thinking-block-validator",
|
"thinking-block-validator",
|
||||||
@@ -79,6 +101,8 @@ export function createTransformHooks(args: {
|
|||||||
claudeCodeHooks,
|
claudeCodeHooks,
|
||||||
keywordDetector,
|
keywordDetector,
|
||||||
contextInjectorMessagesTransform,
|
contextInjectorMessagesTransform,
|
||||||
|
teamModeStatusInjector,
|
||||||
|
teamMailboxInjector,
|
||||||
thinkingBlockValidator,
|
thinkingBlockValidator,
|
||||||
toolPairValidator,
|
toolPairValidator,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user