fix: use ctx.directory instead of process.cwd() in tools for Desktop app support

Convert grep, glob, ast-grep, and session-manager tools from static exports to factory functions that receive PluginInput context. This allows them to use ctx.directory instead of process.cwd(), fixing issue #658 where tools search from wrong directory in OpenCode Desktop app.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-02-07 19:04:31 +09:00
parent 4d7f85a7c3
commit ad17f5eb0a
10 changed files with 282 additions and 287 deletions
+8
View File
@@ -86,6 +86,10 @@ import {
createTaskGetTool,
createTaskList,
createTaskUpdateTool,
createGrepTools,
createGlobTools,
createAstGrepTools,
createSessionManagerTools,
} from "./tools";
import {
CATEGORY_DESCRIPTIONS,
@@ -538,6 +542,10 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
const allTools: Record<string, ToolDefinition> = {
...builtinTools,
...createGrepTools(ctx),
...createGlobTools(ctx),
...createAstGrepTools(ctx),
...createSessionManagerTools(ctx),
...backgroundTools,
call_omo_agent: callOmoAgent,
...(lookAt ? { look_at: lookAt } : {}),