summaryrefslogtreecommitdiffhomepage
path: root/packages/plugin/src
diff options
context:
space:
mode:
authorDax <[email protected]>2025-09-01 17:15:49 -0400
committerGitHub <[email protected]>2025-09-01 17:15:49 -0400
commitf993541e0b538388969defc94d08c3a7af5ef873 (patch)
treeae9898664175faf69583e0bbb1b10135c645d798 /packages/plugin/src
parente2df3eb44dc8b032f74ed0273a53be5f83aaab13 (diff)
downloadopencode-f993541e0b538388969defc94d08c3a7af5ef873.tar.gz
opencode-f993541e0b538388969defc94d08c3a7af5ef873.zip
Refactor to support multiple instances inside single opencode process (#2360)
This release has a bunch of minor breaking changes if you are using opencode plugins or sdk 1. storage events have been removed (we might bring this back but had some issues) 2. concept of `app` is gone - there is a new concept called `project` and endpoints to list projects and get the current project 3. plugin receives `directory` which is cwd and `worktree` which is where the root of the project is if it's a git repo 4. the session.chat function has been renamed to session.prompt in sdk. it no longer requires model to be passed in (model is now an object) 5. every endpoint takes an optional `directory` parameter to operate as though opencode is running in that directory
Diffstat (limited to 'packages/plugin/src')
-rw-r--r--packages/plugin/src/example.ts2
-rw-r--r--packages/plugin/src/index.ts6
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/plugin/src/example.ts b/packages/plugin/src/example.ts
index 998108f0a..a13c0fbac 100644
--- a/packages/plugin/src/example.ts
+++ b/packages/plugin/src/example.ts
@@ -1,6 +1,6 @@
import { Plugin } from "./index"
-export const ExamplePlugin: Plugin = async ({ app, client, $ }) => {
+export const ExamplePlugin: Plugin = async ({ client, $ }) => {
return {
permission: {},
async "chat.params"(input, output) {
diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts
index 5483607a6..a00b48d10 100644
--- a/packages/plugin/src/index.ts
+++ b/packages/plugin/src/index.ts
@@ -1,7 +1,7 @@
import type {
Event,
createOpencodeClient,
- App,
+ Project,
Model,
Provider,
Permission,
@@ -14,7 +14,9 @@ import type { BunShell } from "./shell"
export type PluginInput = {
client: ReturnType<typeof createOpencodeClient>
- app: App
+ project: Project
+ directory: string
+ worktree: string
$: BunShell
}
export type Plugin = (input: PluginInput) => Promise<Hooks>