You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c19186e
Browse filesBrowse the repository at this point in the historyBrowse files
Effect-native scoped OpenCode host for in-process applications.
4
-
5
-
The SDK executes Server's assembled HTTP router in memory. It opens no listener and performs no network I/O, while preserving the same routing, middleware, handlers, codecs, and errors as the network client.
3
+
In-process OpenCode host for Promise and Effect applications. The SDK executes Server's assembled HTTP router in memory, opening no listener and adding no network hop.
It also exports `Tool` for plugins that add tools with `ctx.tool.transform(...)`. Embedded plugins run through the ordinary discovery flow and register tools into each Location's `ToolRegistry` through the normal `Tools.Service.register(...)` path. Closing the owning Effect Scope releases router resources, location services, fibers, and scoped tool registrations.
14
+
Pass imported Promise plugins in `plugins`, or register one later with `await opencode.plugin(plugin)`.
15
15
16
-
Embedded hosts are silent by default. Set `log` to receive structured log entries at the selected minimum level:
16
+
The Promise API uses the same values, errors, request options, and `AsyncIterable` streams as `@opencode-ai/client`.
17
+
18
+
Embedded hosts are silent by default. Set `log` to receive structured log entries:
`sessions.events({ sessionID, after })`replays durable events after the optional aggregate sequence, then emits newly committed durable events. `sessions.interrupt(...)` targets execution owned by this host, and `sessions.message(...)` retrieves one projected Session message.
The same constructor is available as a service Layer:
31
+
## Workerd
32
+
33
+
Use the Workerd entrypoint inside a Cloudflare Durable Object. Hold one host for the lifetime of the object instance rather than creating one per request.
`OpenCode.layer(options)` adapts the scoped `OpenCode.create(options)` convenience constructor for dependency injection.
59
+
`blockConcurrencyWhile` keeps every Durable Object event out until the host is ready and resets the object if initialization fails. The retained Promise gives request handlers direct access to the same host after startup. Configuration is a typed JavaScript object, and plugins are imported values bundled with the Worker.
43
60
44
-
Workspace providers are host infrastructure configured when the SDK is constructed. Workspace lifecycle operations remain on the typed facade:
61
+
## Effect
62
+
63
+
The Effect-native API remains available from `@opencode-ai/sdk/effect`:
0 commit comments