fix(tool-registry): use interactive bash availability for tool registration
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -83,7 +83,7 @@ describe("#given task_system configuration", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe("#given tmux integration is disabled", () => {
|
describe("#given tmux integration is disabled", () => {
|
||||||
test("#when tool registry is created #then interactive_bash is not registered", () => {
|
test("#when system tmux is available #then interactive_bash remains registered", () => {
|
||||||
const result = createToolRegistry({
|
const result = createToolRegistry({
|
||||||
ctx: { directory: "/tmp" } as Parameters<typeof createToolRegistry>[0]["ctx"],
|
ctx: { directory: "/tmp" } as Parameters<typeof createToolRegistry>[0]["ctx"],
|
||||||
pluginConfig: {
|
pluginConfig: {
|
||||||
@@ -108,6 +108,38 @@ describe("#given tmux integration is disabled", () => {
|
|||||||
disabledSkills: new Set(),
|
disabledSkills: new Set(),
|
||||||
},
|
},
|
||||||
availableCategories: [],
|
availableCategories: [],
|
||||||
|
interactiveBashEnabled: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(result.filteredTools).toHaveProperty("interactive_bash")
|
||||||
|
})
|
||||||
|
|
||||||
|
test("#when system tmux is unavailable #then interactive_bash is not registered", () => {
|
||||||
|
const result = createToolRegistry({
|
||||||
|
ctx: { directory: "/tmp" } as Parameters<typeof createToolRegistry>[0]["ctx"],
|
||||||
|
pluginConfig: {
|
||||||
|
tmux: {
|
||||||
|
enabled: false,
|
||||||
|
layout: "main-vertical",
|
||||||
|
main_pane_size: 60,
|
||||||
|
main_pane_min_width: 120,
|
||||||
|
agent_pane_min_width: 40,
|
||||||
|
isolation: "inline",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
managers: {
|
||||||
|
backgroundManager: {},
|
||||||
|
tmuxSessionManager: {},
|
||||||
|
skillMcpManager: {},
|
||||||
|
} as Parameters<typeof createToolRegistry>[0]["managers"],
|
||||||
|
skillContext: {
|
||||||
|
mergedSkills: [],
|
||||||
|
availableSkills: [],
|
||||||
|
browserProvider: "playwright",
|
||||||
|
disabledSkills: new Set(),
|
||||||
|
},
|
||||||
|
availableCategories: [],
|
||||||
|
interactiveBashEnabled: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(result.filteredTools).not.toHaveProperty("interactive_bash")
|
expect(result.filteredTools).not.toHaveProperty("interactive_bash")
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type {
|
|||||||
AvailableCategory,
|
AvailableCategory,
|
||||||
} from "../agents/dynamic-agent-prompt-builder"
|
} from "../agents/dynamic-agent-prompt-builder"
|
||||||
import type { OhMyOpenCodeConfig } from "../config"
|
import type { OhMyOpenCodeConfig } from "../config"
|
||||||
import { isTmuxIntegrationEnabled } from "../create-runtime-tmux-config"
|
import { isInteractiveBashEnabled } from "../create-runtime-tmux-config"
|
||||||
import type { PluginContext, ToolsRecord } from "./types"
|
import type { PluginContext, ToolsRecord } from "./types"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -104,10 +104,16 @@ export function createToolRegistry(args: {
|
|||||||
managers: Pick<Managers, "backgroundManager" | "tmuxSessionManager" | "skillMcpManager">
|
managers: Pick<Managers, "backgroundManager" | "tmuxSessionManager" | "skillMcpManager">
|
||||||
skillContext: SkillContext
|
skillContext: SkillContext
|
||||||
availableCategories: AvailableCategory[]
|
availableCategories: AvailableCategory[]
|
||||||
|
interactiveBashEnabled?: boolean
|
||||||
}): ToolRegistryResult {
|
}): ToolRegistryResult {
|
||||||
const { ctx, pluginConfig, managers, skillContext, availableCategories } = args
|
const {
|
||||||
const tmuxIntegrationEnabled = isTmuxIntegrationEnabled(pluginConfig)
|
ctx,
|
||||||
|
pluginConfig,
|
||||||
|
managers,
|
||||||
|
skillContext,
|
||||||
|
availableCategories,
|
||||||
|
interactiveBashEnabled = isInteractiveBashEnabled(),
|
||||||
|
} = args
|
||||||
const backgroundTools = createBackgroundTools(managers.backgroundManager, ctx.client)
|
const backgroundTools = createBackgroundTools(managers.backgroundManager, ctx.client)
|
||||||
const callOmoAgent = createCallOmoAgent(
|
const callOmoAgent = createCallOmoAgent(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -204,7 +210,7 @@ export function createToolRegistry(args: {
|
|||||||
task: delegateTask,
|
task: delegateTask,
|
||||||
skill_mcp: skillMcpTool,
|
skill_mcp: skillMcpTool,
|
||||||
skill: skillTool,
|
skill: skillTool,
|
||||||
...(tmuxIntegrationEnabled ? { interactive_bash } : {}),
|
...(interactiveBashEnabled ? { interactive_bash } : {}),
|
||||||
...taskToolsRecord,
|
...taskToolsRecord,
|
||||||
...hashlineToolsRecord,
|
...hashlineToolsRecord,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user