mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 17:01:37 +03:00
docs(client): fix the Effect client example
The example named client.sessions and passed prompt: Prompt.make(...); the Effect entrypoint exposes client.session and session.prompt takes text. Copying it produced a call that neither typechecks nor decodes.
This commit is contained in:
@@ -16,12 +16,12 @@ The Promise root remains structural and has no Core or Effect runtime dependency
|
||||
Effect consumers construct canonical decoded inputs:
|
||||
|
||||
```ts
|
||||
import { AbsolutePath, Location, OpenCode, Prompt } from "@opencode/client/effect"
|
||||
import { AbsolutePath, Location, OpenCode } from "@opencode/client/effect"
|
||||
|
||||
const client = yield * OpenCode.make({ baseUrl: "https://opencode.example" })
|
||||
yield *
|
||||
client.sessions.create({
|
||||
const session = yield *
|
||||
client.session.create({
|
||||
location: Location.Ref.make({ directory: AbsolutePath.make("/workspace") }),
|
||||
})
|
||||
yield * client.sessions.prompt({ sessionID, prompt: Prompt.make({ text: "Hello" }) })
|
||||
yield * client.session.prompt({ sessionID: session.id, text: "Hello" })
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user