perf(init): use background tmux path check
- Call startTmuxCheck() at plugin initialization instead of blocking await - Remove tmuxAvailable check, always include interactive_bash tool - Tool gracefully handles missing tmux via getCachedTmuxPath() ?? "tmux" 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
16
src/index.ts
16
src/index.ts
@@ -54,7 +54,7 @@ import {
|
|||||||
createSkillMcpTool,
|
createSkillMcpTool,
|
||||||
sessionExists,
|
sessionExists,
|
||||||
interactive_bash,
|
interactive_bash,
|
||||||
getTmuxPath,
|
startTmuxCheck,
|
||||||
} from "./tools";
|
} from "./tools";
|
||||||
import { BackgroundManager } from "./features/background-agent";
|
import { BackgroundManager } from "./features/background-agent";
|
||||||
import { SkillMcpManager } from "./features/skill-mcp-manager";
|
import { SkillMcpManager } from "./features/skill-mcp-manager";
|
||||||
@@ -65,6 +65,9 @@ import { createModelCacheState, getModelLimit } from "./plugin-state";
|
|||||||
import { createConfigHandler } from "./plugin-handlers";
|
import { createConfigHandler } from "./plugin-handlers";
|
||||||
|
|
||||||
const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||||
|
// Start background tmux check immediately
|
||||||
|
startTmuxCheck();
|
||||||
|
|
||||||
const pluginConfig = loadPluginConfig(ctx.directory, ctx);
|
const pluginConfig = loadPluginConfig(ctx.directory, ctx);
|
||||||
const disabledHooks = new Set(pluginConfig.disabled_hooks ?? []);
|
const disabledHooks = new Set(pluginConfig.disabled_hooks ?? []);
|
||||||
const isHookEnabled = (hookName: HookName) => !disabledHooks.has(hookName);
|
const isHookEnabled = (hookName: HookName) => !disabledHooks.has(hookName);
|
||||||
@@ -219,12 +222,9 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
getSessionID: getSessionIDForMcp,
|
getSessionID: getSessionIDForMcp,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [googleAuthHooks, tmuxAvailable] = await Promise.all([
|
const googleAuthHooks = pluginConfig.google_auth !== false
|
||||||
pluginConfig.google_auth !== false
|
? await createGoogleAntigravityAuthPlugin(ctx)
|
||||||
? createGoogleAntigravityAuthPlugin(ctx)
|
: null;
|
||||||
: Promise.resolve(null),
|
|
||||||
getTmuxPath(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
const configHandler = createConfigHandler({
|
const configHandler = createConfigHandler({
|
||||||
ctx,
|
ctx,
|
||||||
@@ -242,7 +242,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
look_at: lookAt,
|
look_at: lookAt,
|
||||||
skill: skillTool,
|
skill: skillTool,
|
||||||
skill_mcp: skillMcpTool,
|
skill_mcp: skillMcpTool,
|
||||||
...(tmuxAvailable ? { interactive_bash } : {}),
|
interactive_bash, // Always included, handles missing tmux gracefully via getCachedTmuxPath() ?? "tmux"
|
||||||
},
|
},
|
||||||
|
|
||||||
"chat.message": async (input, output) => {
|
"chat.message": async (input, output) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user