agent.ts 730 B

1234567891011121314151617181920
  1. import { Agent } from "@opencode-ai/schema/agent"
  2. import { Location } from "@opencode-ai/schema/location"
  3. import { Schema } from "effect"
  4. import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
  5. import { LocationQuery, locationQueryOpenApi } from "./location"
  6. export const AgentGroup = HttpApiGroup.make("server.agent").add(
  7. HttpApiEndpoint.get("agent.list", "/api/agent", {
  8. query: LocationQuery,
  9. success: Location.response(Schema.Array(Agent.Info)),
  10. })
  11. .annotateMerge(locationQueryOpenApi)
  12. .annotateMerge(
  13. OpenApi.annotations({
  14. identifier: "v2.agent.list",
  15. summary: "List agents",
  16. description: "Retrieve currently registered agents.",
  17. }),
  18. ),
  19. )