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,5 +1,5 @@
import { EOL } from "os"
import { Effect, Option } from "effect"
import { Effect } from "effect"
import { Catalog } from "@opencode-ai/core/catalog"
import { LocationServiceMap } from "@opencode-ai/core/location-layer"
import { Location } from "@opencode-ai/core/location"
@ -19,15 +19,13 @@ export const V2Command = effectCmd({
const all = (yield* catalog.provider.all()).sort((a, b) => a.id.localeCompare(b.id))
const result = {
providers,
default: catalog.model
.default()
.pipe(Effect.map(Option.map((item) => item.id)), Effect.map(Option.getOrUndefined)),
default: catalog.model.default().pipe(Effect.map((item) => item?.id)),
small: Object.fromEntries(
yield* Effect.all(
all.map((provider) =>
Effect.map(
catalog.model.small(provider.id),
(model) => [provider.id, Option.getOrUndefined(Option.map(model, (item) => item.id))] as const,
(model) => [provider.id, model?.id] as const,
),
),
{ concurrency: "unbounded" },