From f993541e0b538388969defc94d08c3a7af5ef873 Mon Sep 17 00:00:00 2001 From: Dax Date: Mon, 1 Sep 2025 17:15:49 -0400 Subject: 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 --- specs/project.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 specs/project.md (limited to 'specs') diff --git a/specs/project.md b/specs/project.md new file mode 100644 index 000000000..dd51f0e7f --- /dev/null +++ b/specs/project.md @@ -0,0 +1,65 @@ +## project + +goal is to let a single instance of opencode be able to run sessions for +multiple projects and different worktrees per project + +### api + +``` +GET /project -> Project[] + +POST /project/init -> Project + + +GET /project/:projectID/session -> Session[] + +GET /project/:projectID/session/:sessionID -> Session + +POST /project/:projectID/session -> Session +{ + id?: string + parentID?: string + directory: string +} + +DELETE /project/:projectID/session/:sessionID + +POST /project/:projectID/session/:sessionID/init + +POST /project/:projectID/session/:sessionID/abort + +POST /project/:projectID/session/:sessionID/share + +DELETE /project/:projectID/session/:sessionID/share + +POST /project/:projectID/session/:sessionID/compact + +GET /project/:projectID/session/:sessionID/message -> { info: Message, parts: Part[] }[] + +GET /project/:projectID/session/:sessionID/message/:messageID -> { info: Message, parts: Part[] } + +POST /project/:projectID/session/:sessionID/message -> { info: Message, parts: Part[] } + +POST /project/:projectID/session/:sessionID/revert -> Session + +POST /project/:projectID/session/:sessionID/unrevert -> Session + +POST /project/:projectID/session/:sessionID/permission/:permissionID -> Session + +GET /project/:projectID/session/:sessionID/find/file -> string[] + +GET /project/:projectID/session/:sessionID/file -> { type: "raw" | "patch", content: string } + +GET /project/:projectID/session/:sessionID/file/status -> File[] + +POST /log + +// These are awkward + +GET /provider?directory= -> Provider +GET /config?directory= -> Config // think only tui uses this? + +GET /project/:projectID/agent?directory= -> Agent +GET /project/:projectID/find/file?directory= -> File + +``` -- cgit v1.2.3