mirror of
https://github.com/Heretek-AI/opencode.git
synced 2026-11-23 17:09:27 -10:00
19 lines
602 B
TypeScript
19 lines
602 B
TypeScript
export * as OpenCode from "./client.js"
|
|
|
|
import { SharedEvents } from "../shared-events.js"
|
|
import { OpenCode } from "./generated/index.js"
|
|
import type { ClientOptions } from "./generated/client.js"
|
|
import { makeRpc } from "./rpc.js"
|
|
|
|
export type { ClientOptions, RequestOptions } from "./generated/client.js"
|
|
|
|
export function make(options: ClientOptions) {
|
|
const raw = OpenCode.make(options)
|
|
const events = SharedEvents.make((signal, onActivity) => raw.event.subscribe({ signal, onActivity }))
|
|
return {
|
|
...raw,
|
|
rpc: Object.assign(makeRpc(raw, events), raw.rpc),
|
|
event: events,
|
|
}
|
|
}
|