From c00f3dc622d9aec7e1cf5803fc9ed3f38d8f1a09 Mon Sep 17 00:00:00 2001 From: cooooooooooode <187372691+cooooooooooode@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:53:41 +0800 Subject: [PATCH] fix: add directory to plugin client for multi-project support When OpenCode Server serves multiple projects, plugin's internal client needs to specify the target directory. Without this, API calls from plugins (e.g., delegate_task calling session.get) would fallback to process.cwd(), causing NotFoundError when accessing sessions from different projects. This fix ensures each Instance's plugin client includes the correct directory parameter, enabling proper cross-project session access in multi-project environments like oh-my-opencodeui. --- packages/opencode/src/plugin/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/opencode/src/plugin/index.ts b/packages/opencode/src/plugin/index.ts index 6032935f8480..68d0e549f417 100644 --- a/packages/opencode/src/plugin/index.ts +++ b/packages/opencode/src/plugin/index.ts @@ -23,6 +23,7 @@ export namespace Plugin { const state = Instance.state(async () => { const client = createOpencodeClient({ baseUrl: "http://localhost:4096", + directory: Instance.directory, // @ts-ignore - fetch type incompatibility fetch: async (...args) => Server.App().fetch(...args), })