Something went wrong. Try again.
opencode v2 mirror
Something went wrong. Try again.
1234567891011121314151617181920212223import { define } from "@opencode/plugin/effect/plugin"import type { AISDKHooks } from "@opencode/plugin/effect/aisdk"import { Effect } from "effect"
export function createProviderPlugin(input: { readonly id: string readonly package: string readonly load: (options: AISDKHooks["sdk"]["options"]) => Promise<unknown>}) { return define({ id: input.id, effect: Effect.fn(function* (ctx) { yield* ctx.aisdk.hook( "sdk", Effect.fn(function* (evt) { if (evt.package !== input.package) return evt.sdk = yield* Effect.promise(() => input.load(evt.options)) }), ) }), })}