refactor(core): move models.dev into core (#27347)
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
import { EOL } from "os"
|
||||
import { Effect, Layer, Option } from "effect"
|
||||
import { Catalog } from "@opencode-ai/core/catalog"
|
||||
import { InstanceServiceMap } from "@opencode-ai/core/instance-layer"
|
||||
import { PluginBoot } from "@opencode-ai/core/plugin/boot"
|
||||
import { effectCmd } from "../../effect-cmd"
|
||||
import { PluginBoot } from "@/v2/plugin-boot"
|
||||
|
||||
const layer = Catalog.defaultLayer.pipe(Layer.provide(PluginBoot.defaultLayer))
|
||||
const Runtime = Layer.mergeAll(InstanceServiceMap.layer)
|
||||
|
||||
export const V2Command = effectCmd({
|
||||
command: "v2",
|
||||
describe: "debug v2 catalog and built-in plugins",
|
||||
instance: false,
|
||||
handler: Effect.fn("Cli.debug.v2")(function* () {
|
||||
const result = yield* Effect.gen(function* () {
|
||||
handler: Effect.fn("Cli.debug.v2")(
|
||||
function* () {
|
||||
yield* PluginBoot.Service.use((service) => service.wait())
|
||||
const catalog = yield* Catalog.Service
|
||||
|
||||
const providers = (yield* catalog.provider.available()).sort((a, b) => a.id.localeCompare(b.id))
|
||||
const all = (yield* catalog.provider.all()).sort((a, b) => a.id.localeCompare(b.id))
|
||||
return {
|
||||
const result = {
|
||||
providers,
|
||||
default: catalog.model
|
||||
.default()
|
||||
@@ -33,8 +34,13 @@ export const V2Command = effectCmd({
|
||||
),
|
||||
),
|
||||
}
|
||||
}).pipe(Effect.provide(layer), Effect.orDie)
|
||||
|
||||
process.stdout.write(JSON.stringify(result, null, 2) + EOL)
|
||||
}),
|
||||
process.stdout.write(JSON.stringify(result, null, 2) + EOL)
|
||||
},
|
||||
Effect.provide(
|
||||
InstanceServiceMap.get({
|
||||
directory: process.cwd(),
|
||||
}),
|
||||
),
|
||||
Effect.provide(Runtime),
|
||||
),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user