plugin: honor tmux disablement for interactive tmux features
This commit is contained in:
@@ -53,4 +53,30 @@ describe("createSessionHooks", () => {
|
||||
// then
|
||||
expect(result.modelFallback).not.toBeNull()
|
||||
})
|
||||
|
||||
it("skips interactive bash session hook when tmux integration is disabled", () => {
|
||||
// given
|
||||
const pluginConfig = {
|
||||
tmux: {
|
||||
enabled: false,
|
||||
layout: "main-vertical",
|
||||
main_pane_size: 60,
|
||||
main_pane_min_width: 120,
|
||||
agent_pane_min_width: 40,
|
||||
isolation: "inline",
|
||||
},
|
||||
} as OhMyOpenCodeConfig
|
||||
|
||||
// when
|
||||
const result = createSessionHooks({
|
||||
ctx: mockContext,
|
||||
pluginConfig,
|
||||
modelCacheState: mockModelCacheState,
|
||||
isHookEnabled: (hookName) => hookName === "interactive-bash-session",
|
||||
safeHookEnabled: true,
|
||||
})
|
||||
|
||||
// then
|
||||
expect(result.interactiveBashSession).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -36,6 +36,7 @@ import {
|
||||
} from "../../shared"
|
||||
import { safeCreateHook } from "../../shared/safe-create-hook"
|
||||
import { sessionExists } from "../../tools"
|
||||
import { isTmuxIntegrationEnabled } from "../../create-runtime-tmux-config"
|
||||
|
||||
export type SessionHooks = {
|
||||
contextWindowMonitor: ReturnType<typeof createContextWindowMonitorHook> | null
|
||||
@@ -196,7 +197,9 @@ export function createSessionHooks(args: {
|
||||
? safeHook("non-interactive-env", () => createNonInteractiveEnvHook(ctx))
|
||||
: null
|
||||
|
||||
const interactiveBashSession = isHookEnabled("interactive-bash-session")
|
||||
const interactiveBashSession =
|
||||
isHookEnabled("interactive-bash-session") &&
|
||||
isTmuxIntegrationEnabled(pluginConfig)
|
||||
? safeHook("interactive-bash-session", () => createInteractiveBashSessionHook(ctx))
|
||||
: null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user