import { Context, type Effect } from "effect" import type { HttpClientRequest, HttpClientResponse } from "effect/unstable/http" import type { AIError } from "../schema/errors.js" // The service tag lives in its own leaf module so `Media.Asset` (imported by the schema layer) can require the // executor without pulling the full executor implementation, and therefore the schema barrel, into a cycle. export interface Interface { readonly execute: ( request: HttpClientRequest.HttpClientRequest, middleware?: HttpMiddleware, ) => Effect.Effect } export type HttpHandler = ( request: HttpClientRequest.HttpClientRequest, ) => Effect.Effect export type HttpMiddleware = ( request: HttpClientRequest.HttpClientRequest, handler: HttpHandler, ) => Effect.Effect export class Service extends Context.Service()("@opencode/AI/RequestExecutor") {}