15 lines
578 B
TypeScript
15 lines
578 B
TypeScript
import { AgentV2 } from "@opencode-ai/core/agent"
|
|
import { PluginBoot } from "@opencode-ai/core/plugin/boot"
|
|
import { Effect } from "effect"
|
|
import { HttpApiBuilder } from "effect/unstable/httpapi"
|
|
import { Api } from "../api"
|
|
import { response } from "../groups/location"
|
|
|
|
export const AgentHandler = HttpApiBuilder.group(Api, "server.agent", (handlers) =>
|
|
handlers.handle("agent.list", () =>
|
|
Effect.gen(function* () {
|
|
yield* PluginBoot.Service.use((plugin) => plugin.wait())
|
|
return yield* response(AgentV2.Service.use((agent) => agent.all()))
|
|
}),
|
|
),
|
|
)
|