mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
A session's workspace placement could only be set through the internal Effect SDK. This opens it to agents, plugins and the HTTP API behind the new `workspaces` flag: - `Session.create` accepts `parentID` together with an explicit `location`, so a child can run on a different placement; a plain `parentID` child still copies its parent. - The `subagent` tool gains optional `workspaceID` and `directory`; reusing an existing child with a different placement fails instead of changing it. - New `opencode` tools `workspace_providers`, `workspace_create` (create and provision) and `workspace_destroy`, permission-gated. - `session_move` accepts `workspaceID` and passes the session's current one when omitted, so moving between directories no longer silently drops a workspace placement. Core move skips the host directory stat and host project resolution for workspace destinations; the Location layer resolves the project. - Plugin `session.create` accepts `location.workspace`. - HTTP: `experimental.workspaceID` on `session.create` and `session.move`, and a new experimental group `/api/experimental/workspace/*` (providers, create, provision, destroy). Generated clients regenerated. Verified: `bun typecheck` in schema, core, plugin, protocol, server, client and sdk; `bun run check` at the root; protocol experimental-identifiers test; core session-create, session-move, tool-opencode, tool-subagent and plugin tests; server session handler tests; sdk embedded test (child placed on a workspace while a plain child inherits). |
||
|---|---|---|
| .. | ||
| script | ||
| src | ||
| test | ||
| .gitignore | ||
| AGENTS.md | ||
| package.json | ||
| README.md | ||
| sst-env.d.ts | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
@opencode/plugin
Authoring interfaces and runtime loader support for OpenCode V2 plugins:
@opencode/plugin— Promise plugin API@opencode/plugin/effect— Effect plugin API@opencode/plugin/rpc— portable RPC contract definitions@opencode/plugin/tui— terminal UI plugin API
Packaging And Runtime effect
When the OpenCode CLI loads server or TUI plugins, it resolves imports of effect, exported effect/* subpaths, and @opencode/plugin entrypoints (including imports from dependencies inside a plugin's node_modules) to the host's runtime module instances so fibers, loggers, and Schema parsers share one copy.
- Declare
"effect": "^4.0.0"as apeerDependency(anddevDependencyfor local type-checking and testing) rather than a bundled runtime dependency. - Do not bundle
effectinto published plugin files; if you build with a bundler, keepeffectandeffect/*external. Two copies ofeffectdo not share fiber, logger, orSchemainternals. - Plugins and their
node_modulesdependencies always receive OpenCode's hosteffectinstance. UseeffectAPIs and module paths compatible with the OpenCode release you target; dependencies built on anothereffectmajor (such as Effect 3) are not supported. - Only public
effectsubpaths are provided. A plugin that imports one of Effect's privateinternalmodules fails to load with an error naming the path. - The compiled OpenCode binary does not include the Scalar and Swagger UI assets used by Effect's HTTP API docs pages; serving those pages from a plugin shows a notice instead.