James Long 5691f36e98 refactor(core): remove tool layer exports (#34622) 1 mês atrás
..
src 5691f36e98 refactor(core): remove tool layer exports (#34622) 1 mês atrás
test 42e6b7db32 feat(sdk): expose live event stream (#34098) 1 mês atrás
README.md f44423609b feat(sdk): restore session runtime operations (#33777) 1 mês atrás
package.json cdd67cf30f feat(sdk): add HttpApi clients and embedded host (#33445) 1 mês atrás
sst-env.d.ts fec087bf37 zen: new inference 1 mês atrás
tsconfig.json cdd67cf30f feat(sdk): add HttpApi clients and embedded host (#33445) 1 mês atrás

README.md

@opencode-ai/sdk-next

Effect-native scoped OpenCode host for in-process applications. This transitional package will replace the existing generated @opencode-ai/sdk after its consumers migrate.

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.

import { OpenCode } from "@opencode-ai/sdk-next"

const opencode = yield * OpenCode.create()
const session = yield * opencode.sessions.get({ sessionID })

It also exports Tool and exposes local-only tools.register(...), replacing the former @opencode-ai/core/public facade. Registration uses Core's host-level ApplicationTools service shared by the host's Locations; each Location retains its own ToolRegistry for overlay, lookup, and settlement. Closing the owning Effect Scope releases router resources, location services, fibers, and scoped tool registrations.

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:

const program = Effect.gen(function* () {
  const opencode = yield* OpenCode.Service
  return yield* opencode.sessions.get({ sessionID })
})

yield * program.pipe(Effect.provide(OpenCode.layer))

OpenCode.layer adapts OpenCode.create() for dependency injection; it does not define another host implementation.