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).
Workspace drivers could only be injected by the embedding host through
`OpenCode.create({ workspaceProviders })`. The driver registry is now a
transformable State (same pattern as artifact providers), and plugins get an
`experimental.workspace` domain with `transform` (add/remove a driver),
`providers`, `create`, `provision` and `destroy`. Host-provided drivers remain
the base state; the latest active plugin registration for a name wins and
disposing it restores the previous driver.
State.create gains a `scope: "global"` option so a global registry is not
closed by a Location shutdown batch. The Environment file types move to
`@opencode/plugin/effect/environment-files` so plugin drivers can type their
`connect` result; core re-exports them.
Verified: `bun typecheck` in core, plugin and sdk; `bun test
test/embedded.test.ts` in sdk (plugin-registered driver provisions a
workspace); `bun test test/workspace*.test.ts` in core.