feat(plugin): add v2 effect host (#33111)

This commit is contained in:
Dax 2026-06-21 14:05:49 +02:00 committed by GitHub
commit c780d7cee7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
139 changed files with 3740 additions and 1943 deletions

View file

@ -1,6 +1,6 @@
import path from "path"
import { describe, expect } from "bun:test"
import { Effect, Layer } from "effect"
import { Effect, Layer, Stream } from "effect"
import { Catalog } from "@opencode-ai/core/catalog"
import { Integration } from "@opencode-ai/core/integration"
import { Credential } from "@opencode-ai/core/credential"
@ -15,6 +15,7 @@ import { Policy } from "@opencode-ai/core/policy"
import { AbsolutePath } from "@opencode-ai/core/schema"
import { location } from "../fixture/location"
import { testEffect } from "../lib/effect"
import { catalogHost, host, integrationHost } from "./host"
const events = EventV2.defaultLayer
const locationLayer = Layer.succeed(
@ -56,8 +57,15 @@ describe("ModelsDevPlugin", () => {
}),
() =>
Effect.gen(function* () {
yield* ModelsDevPlugin.effect
const integrations = yield* Integration.Service
const catalog = yield* Catalog.Service
yield* ModelsDevPlugin.effect(
host({
catalog: catalogHost(catalog),
event: { subscribe: () => Stream.never },
integration: integrationHost(integrations),
}),
)
expect(yield* integrations.list()).toEqual([
new Integration.Info({
id: Integration.ID.make("acme"),