// Generated by @opencode-ai/httpapi-codegen. Do not edit.
import { Effect, Stream, Schema } from "effect"
import { Sse } from "effect/unstable/encoding"
import { HttpClientError } from "effect/unstable/http"
import { HttpApiClient } from "effect/unstable/httpapi"
import { ClientApi } from "../../contract"
import { ClientError } from "./client-error"

type RawClient = HttpApiClient.ForApi<typeof ClientApi>

const mapClientError = <E>(error: E) =>
  HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error)
    ? new ClientError({ cause: error })
    : error

const Endpoint0_0 = (raw: RawClient["server.health"]) => () =>
  raw["health.get"]({}).pipe(Effect.mapError(mapClientError))

const adaptGroup0 = (raw: RawClient["server.health"]) => ({ get: Endpoint0_0(raw) })

type Endpoint1_0Request = Parameters<RawClient["server.location"]["location.get"]>[0]
type Endpoint1_0Input = { readonly location?: Endpoint1_0Request["query"]["location"] }
const Endpoint1_0 = (raw: RawClient["server.location"]) => (input?: Endpoint1_0Input) =>
  raw["location.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

const adaptGroup1 = (raw: RawClient["server.location"]) => ({ get: Endpoint1_0(raw) })

type Endpoint2_0Request = Parameters<RawClient["server.agent"]["agent.list"]>[0]
type Endpoint2_0Input = { readonly location?: Endpoint2_0Request["query"]["location"] }
const Endpoint2_0 = (raw: RawClient["server.agent"]) => (input?: Endpoint2_0Input) =>
  raw["agent.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

const adaptGroup2 = (raw: RawClient["server.agent"]) => ({ list: Endpoint2_0(raw) })

type Endpoint3_0Request = Parameters<RawClient["server.plugin"]["plugin.list"]>[0]
type Endpoint3_0Input = { readonly location?: Endpoint3_0Request["query"]["location"] }
const Endpoint3_0 = (raw: RawClient["server.plugin"]) => (input?: Endpoint3_0Input) =>
  raw["plugin.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

const adaptGroup3 = (raw: RawClient["server.plugin"]) => ({ list: Endpoint3_0(raw) })

type Endpoint4_0Request = Parameters<RawClient["server.session"]["session.list"]>[0]
type Endpoint4_0Input = {
  readonly workspace?: Endpoint4_0Request["query"]["workspace"]
  readonly limit?: Endpoint4_0Request["query"]["limit"]
  readonly order?: Endpoint4_0Request["query"]["order"]
  readonly search?: Endpoint4_0Request["query"]["search"]
  readonly parentID?: Endpoint4_0Request["query"]["parentID"]
  readonly directory?: Endpoint4_0Request["query"]["directory"]
  readonly project?: Endpoint4_0Request["query"]["project"]
  readonly subpath?: Endpoint4_0Request["query"]["subpath"]
  readonly cursor?: Endpoint4_0Request["query"]["cursor"]
}
const Endpoint4_0 = (raw: RawClient["server.session"]) => (input?: Endpoint4_0Input) =>
  raw["session.list"]({
    query: {
      workspace: input?.["workspace"],
      limit: input?.["limit"],
      order: input?.["order"],
      search: input?.["search"],
      parentID: input?.["parentID"],
      directory: input?.["directory"],
      project: input?.["project"],
      subpath: input?.["subpath"],
      cursor: input?.["cursor"],
    },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint4_1Request = Parameters<RawClient["server.session"]["session.create"]>[0]
type Endpoint4_1Input = {
  readonly id?: Endpoint4_1Request["payload"]["id"]
  readonly agent?: Endpoint4_1Request["payload"]["agent"]
  readonly model?: Endpoint4_1Request["payload"]["model"]
  readonly location?: Endpoint4_1Request["payload"]["location"]
}
const Endpoint4_1 = (raw: RawClient["server.session"]) => (input?: Endpoint4_1Input) =>
  raw["session.create"]({
    payload: { id: input?.["id"], agent: input?.["agent"], model: input?.["model"], location: input?.["location"] },
  }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

const Endpoint4_2 = (raw: RawClient["server.session"]) => () =>
  raw["session.active"]({}).pipe(Effect.mapError(mapClientError))

type Endpoint4_3Request = Parameters<RawClient["server.session"]["session.get"]>[0]
type Endpoint4_3Input = { readonly sessionID: Endpoint4_3Request["params"]["sessionID"] }
const Endpoint4_3 = (raw: RawClient["server.session"]) => (input: Endpoint4_3Input) =>
  raw["session.get"]({ params: { sessionID: input["sessionID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint4_4Request = Parameters<RawClient["server.session"]["session.fork"]>[0]
type Endpoint4_4Input = {
  readonly sessionID: Endpoint4_4Request["params"]["sessionID"]
  readonly messageID?: Endpoint4_4Request["payload"]["messageID"]
}
const Endpoint4_4 = (raw: RawClient["server.session"]) => (input: Endpoint4_4Input) =>
  raw["session.fork"]({ params: { sessionID: input["sessionID"] }, payload: { messageID: input["messageID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint4_5Request = Parameters<RawClient["server.session"]["session.switchAgent"]>[0]
type Endpoint4_5Input = {
  readonly sessionID: Endpoint4_5Request["params"]["sessionID"]
  readonly agent: Endpoint4_5Request["payload"]["agent"]
}
const Endpoint4_5 = (raw: RawClient["server.session"]) => (input: Endpoint4_5Input) =>
  raw["session.switchAgent"]({ params: { sessionID: input["sessionID"] }, payload: { agent: input["agent"] } }).pipe(
    Effect.mapError(mapClientError),
  )

type Endpoint4_6Request = Parameters<RawClient["server.session"]["session.switchModel"]>[0]
type Endpoint4_6Input = {
  readonly sessionID: Endpoint4_6Request["params"]["sessionID"]
  readonly model: Endpoint4_6Request["payload"]["model"]
}
const Endpoint4_6 = (raw: RawClient["server.session"]) => (input: Endpoint4_6Input) =>
  raw["session.switchModel"]({ params: { sessionID: input["sessionID"] }, payload: { model: input["model"] } }).pipe(
    Effect.mapError(mapClientError),
  )

type Endpoint4_7Request = Parameters<RawClient["server.session"]["session.rename"]>[0]
type Endpoint4_7Input = {
  readonly sessionID: Endpoint4_7Request["params"]["sessionID"]
  readonly title: Endpoint4_7Request["payload"]["title"]
}
const Endpoint4_7 = (raw: RawClient["server.session"]) => (input: Endpoint4_7Input) =>
  raw["session.rename"]({ params: { sessionID: input["sessionID"] }, payload: { title: input["title"] } }).pipe(
    Effect.mapError(mapClientError),
  )

type Endpoint4_8Request = Parameters<RawClient["server.session"]["session.prompt"]>[0]
type Endpoint4_8Input = {
  readonly sessionID: Endpoint4_8Request["params"]["sessionID"]
  readonly id?: Endpoint4_8Request["payload"]["id"]
  readonly prompt: Endpoint4_8Request["payload"]["prompt"]
  readonly delivery?: Endpoint4_8Request["payload"]["delivery"]
  readonly resume?: Endpoint4_8Request["payload"]["resume"]
}
const Endpoint4_8 = (raw: RawClient["server.session"]) => (input: Endpoint4_8Input) =>
  raw["session.prompt"]({
    params: { sessionID: input["sessionID"] },
    payload: { id: input["id"], prompt: input["prompt"], delivery: input["delivery"], resume: input["resume"] },
  }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint4_9Request = Parameters<RawClient["server.session"]["session.command"]>[0]
type Endpoint4_9Input = {
  readonly sessionID: Endpoint4_9Request["params"]["sessionID"]
  readonly id?: Endpoint4_9Request["payload"]["id"]
  readonly command: Endpoint4_9Request["payload"]["command"]
  readonly arguments?: Endpoint4_9Request["payload"]["arguments"]
  readonly agent?: Endpoint4_9Request["payload"]["agent"]
  readonly model?: Endpoint4_9Request["payload"]["model"]
  readonly files?: Endpoint4_9Request["payload"]["files"]
  readonly agents?: Endpoint4_9Request["payload"]["agents"]
  readonly delivery?: Endpoint4_9Request["payload"]["delivery"]
  readonly resume?: Endpoint4_9Request["payload"]["resume"]
}
const Endpoint4_9 = (raw: RawClient["server.session"]) => (input: Endpoint4_9Input) =>
  raw["session.command"]({
    params: { sessionID: input["sessionID"] },
    payload: {
      id: input["id"],
      command: input["command"],
      arguments: input["arguments"],
      agent: input["agent"],
      model: input["model"],
      files: input["files"],
      agents: input["agents"],
      delivery: input["delivery"],
      resume: input["resume"],
    },
  }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint4_10Request = Parameters<RawClient["server.session"]["session.skill"]>[0]
type Endpoint4_10Input = {
  readonly sessionID: Endpoint4_10Request["params"]["sessionID"]
  readonly id?: Endpoint4_10Request["payload"]["id"]
  readonly skill: Endpoint4_10Request["payload"]["skill"]
  readonly resume?: Endpoint4_10Request["payload"]["resume"]
}
const Endpoint4_10 = (raw: RawClient["server.session"]) => (input: Endpoint4_10Input) =>
  raw["session.skill"]({
    params: { sessionID: input["sessionID"] },
    payload: { id: input["id"], skill: input["skill"], resume: input["resume"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint4_11Request = Parameters<RawClient["server.session"]["session.synthetic"]>[0]
type Endpoint4_11Input = {
  readonly sessionID: Endpoint4_11Request["params"]["sessionID"]
  readonly text: Endpoint4_11Request["payload"]["text"]
  readonly description?: Endpoint4_11Request["payload"]["description"]
  readonly metadata?: Endpoint4_11Request["payload"]["metadata"]
}
const Endpoint4_11 = (raw: RawClient["server.session"]) => (input: Endpoint4_11Input) =>
  raw["session.synthetic"]({
    params: { sessionID: input["sessionID"] },
    payload: { text: input["text"], description: input["description"], metadata: input["metadata"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint4_12Request = Parameters<RawClient["server.session"]["session.shell"]>[0]
type Endpoint4_12Input = {
  readonly sessionID: Endpoint4_12Request["params"]["sessionID"]
  readonly id?: Endpoint4_12Request["payload"]["id"]
  readonly command: Endpoint4_12Request["payload"]["command"]
}
const Endpoint4_12 = (raw: RawClient["server.session"]) => (input: Endpoint4_12Input) =>
  raw["session.shell"]({
    params: { sessionID: input["sessionID"] },
    payload: { id: input["id"], command: input["command"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint4_13Request = Parameters<RawClient["server.session"]["session.compact"]>[0]
type Endpoint4_13Input = { readonly sessionID: Endpoint4_13Request["params"]["sessionID"] }
const Endpoint4_13 = (raw: RawClient["server.session"]) => (input: Endpoint4_13Input) =>
  raw["session.compact"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint4_14Request = Parameters<RawClient["server.session"]["session.wait"]>[0]
type Endpoint4_14Input = { readonly sessionID: Endpoint4_14Request["params"]["sessionID"] }
const Endpoint4_14 = (raw: RawClient["server.session"]) => (input: Endpoint4_14Input) =>
  raw["session.wait"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint4_15Request = Parameters<RawClient["server.session"]["session.revert.stage"]>[0]
type Endpoint4_15Input = {
  readonly sessionID: Endpoint4_15Request["params"]["sessionID"]
  readonly messageID: Endpoint4_15Request["payload"]["messageID"]
  readonly files?: Endpoint4_15Request["payload"]["files"]
}
const Endpoint4_15 = (raw: RawClient["server.session"]) => (input: Endpoint4_15Input) =>
  raw["session.revert.stage"]({
    params: { sessionID: input["sessionID"] },
    payload: { messageID: input["messageID"], files: input["files"] },
  }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint4_16Request = Parameters<RawClient["server.session"]["session.revert.clear"]>[0]
type Endpoint4_16Input = { readonly sessionID: Endpoint4_16Request["params"]["sessionID"] }
const Endpoint4_16 = (raw: RawClient["server.session"]) => (input: Endpoint4_16Input) =>
  raw["session.revert.clear"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint4_17Request = Parameters<RawClient["server.session"]["session.revert.commit"]>[0]
type Endpoint4_17Input = { readonly sessionID: Endpoint4_17Request["params"]["sessionID"] }
const Endpoint4_17 = (raw: RawClient["server.session"]) => (input: Endpoint4_17Input) =>
  raw["session.revert.commit"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint4_18Request = Parameters<RawClient["server.session"]["session.context"]>[0]
type Endpoint4_18Input = { readonly sessionID: Endpoint4_18Request["params"]["sessionID"] }
const Endpoint4_18 = (raw: RawClient["server.session"]) => (input: Endpoint4_18Input) =>
  raw["session.context"]({ params: { sessionID: input["sessionID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint4_19Request = Parameters<RawClient["server.session"]["session.context.entry.list"]>[0]
type Endpoint4_19Input = { readonly sessionID: Endpoint4_19Request["params"]["sessionID"] }
const Endpoint4_19 = (raw: RawClient["server.session"]) => (input: Endpoint4_19Input) =>
  raw["session.context.entry.list"]({ params: { sessionID: input["sessionID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint4_20Request = Parameters<RawClient["server.session"]["session.context.entry.put"]>[0]
type Endpoint4_20Input = {
  readonly sessionID: Endpoint4_20Request["params"]["sessionID"]
  readonly key: Endpoint4_20Request["params"]["key"]
  readonly value: Endpoint4_20Request["payload"]["value"]
}
const Endpoint4_20 = (raw: RawClient["server.session"]) => (input: Endpoint4_20Input) =>
  raw["session.context.entry.put"]({
    params: { sessionID: input["sessionID"], key: input["key"] },
    payload: { value: input["value"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint4_21Request = Parameters<RawClient["server.session"]["session.context.entry.remove"]>[0]
type Endpoint4_21Input = {
  readonly sessionID: Endpoint4_21Request["params"]["sessionID"]
  readonly key: Endpoint4_21Request["params"]["key"]
}
const Endpoint4_21 = (raw: RawClient["server.session"]) => (input: Endpoint4_21Input) =>
  raw["session.context.entry.remove"]({ params: { sessionID: input["sessionID"], key: input["key"] } }).pipe(
    Effect.mapError(mapClientError),
  )

type Endpoint4_22Request = Parameters<RawClient["server.session"]["session.log"]>[0]
type Endpoint4_22Input = {
  readonly sessionID: Endpoint4_22Request["params"]["sessionID"]
  readonly after?: Endpoint4_22Request["query"]["after"]
  readonly follow?: Endpoint4_22Request["query"]["follow"]
}
const Endpoint4_22 = (raw: RawClient["server.session"]) => (input: Endpoint4_22Input) =>
  Stream.unwrap(
    raw["session.log"]({
      params: { sessionID: input["sessionID"] },
      query: { after: input["after"], follow: input["follow"] },
    }).pipe(
      Effect.mapError(mapClientError),
      Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError))),
    ),
  )

type Endpoint4_23Request = Parameters<RawClient["server.session"]["session.interrupt"]>[0]
type Endpoint4_23Input = { readonly sessionID: Endpoint4_23Request["params"]["sessionID"] }
const Endpoint4_23 = (raw: RawClient["server.session"]) => (input: Endpoint4_23Input) =>
  raw["session.interrupt"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint4_24Request = Parameters<RawClient["server.session"]["session.background"]>[0]
type Endpoint4_24Input = { readonly sessionID: Endpoint4_24Request["params"]["sessionID"] }
const Endpoint4_24 = (raw: RawClient["server.session"]) => (input: Endpoint4_24Input) =>
  raw["session.background"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint4_25Request = Parameters<RawClient["server.session"]["session.message"]>[0]
type Endpoint4_25Input = {
  readonly sessionID: Endpoint4_25Request["params"]["sessionID"]
  readonly messageID: Endpoint4_25Request["params"]["messageID"]
}
const Endpoint4_25 = (raw: RawClient["server.session"]) => (input: Endpoint4_25Input) =>
  raw["session.message"]({ params: { sessionID: input["sessionID"], messageID: input["messageID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

const adaptGroup4 = (raw: RawClient["server.session"]) => ({
  list: Endpoint4_0(raw),
  create: Endpoint4_1(raw),
  active: Endpoint4_2(raw),
  get: Endpoint4_3(raw),
  fork: Endpoint4_4(raw),
  switchAgent: Endpoint4_5(raw),
  switchModel: Endpoint4_6(raw),
  rename: Endpoint4_7(raw),
  prompt: Endpoint4_8(raw),
  command: Endpoint4_9(raw),
  skill: Endpoint4_10(raw),
  synthetic: Endpoint4_11(raw),
  shell: Endpoint4_12(raw),
  compact: Endpoint4_13(raw),
  wait: Endpoint4_14(raw),
  revertStage: Endpoint4_15(raw),
  revertClear: Endpoint4_16(raw),
  revertCommit: Endpoint4_17(raw),
  context: Endpoint4_18(raw),
  listContextEntries: Endpoint4_19(raw),
  putContextEntry: Endpoint4_20(raw),
  removeContextEntry: Endpoint4_21(raw),
  log: Endpoint4_22(raw),
  interrupt: Endpoint4_23(raw),
  background: Endpoint4_24(raw),
  message: Endpoint4_25(raw),
})

type Endpoint5_0Request = Parameters<RawClient["server.message"]["session.messages"]>[0]
type Endpoint5_0Input = {
  readonly sessionID: Endpoint5_0Request["params"]["sessionID"]
  readonly limit?: Endpoint5_0Request["query"]["limit"]
  readonly order?: Endpoint5_0Request["query"]["order"]
  readonly cursor?: Endpoint5_0Request["query"]["cursor"]
}
const Endpoint5_0 = (raw: RawClient["server.message"]) => (input: Endpoint5_0Input) =>
  raw["session.messages"]({
    params: { sessionID: input["sessionID"] },
    query: { limit: input["limit"], order: input["order"], cursor: input["cursor"] },
  }).pipe(Effect.mapError(mapClientError))

const adaptGroup5 = (raw: RawClient["server.message"]) => ({ list: Endpoint5_0(raw) })

type Endpoint6_0Request = Parameters<RawClient["server.model"]["model.list"]>[0]
type Endpoint6_0Input = { readonly location?: Endpoint6_0Request["query"]["location"] }
const Endpoint6_0 = (raw: RawClient["server.model"]) => (input?: Endpoint6_0Input) =>
  raw["model.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint6_1Request = Parameters<RawClient["server.model"]["model.default"]>[0]
type Endpoint6_1Input = { readonly location?: Endpoint6_1Request["query"]["location"] }
const Endpoint6_1 = (raw: RawClient["server.model"]) => (input?: Endpoint6_1Input) =>
  raw["model.default"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

const adaptGroup6 = (raw: RawClient["server.model"]) => ({ list: Endpoint6_0(raw), default: Endpoint6_1(raw) })

type Endpoint7_0Request = Parameters<RawClient["server.generate"]["generate.text"]>[0]
type Endpoint7_0Input = {
  readonly location?: Endpoint7_0Request["query"]["location"]
  readonly prompt: Endpoint7_0Request["payload"]["prompt"]
  readonly model?: Endpoint7_0Request["payload"]["model"]
}
const Endpoint7_0 = (raw: RawClient["server.generate"]) => (input: Endpoint7_0Input) =>
  raw["generate.text"]({
    query: { location: input["location"] },
    payload: { prompt: input["prompt"], model: input["model"] },
  }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

const adaptGroup7 = (raw: RawClient["server.generate"]) => ({ text: Endpoint7_0(raw) })

type Endpoint8_0Request = Parameters<RawClient["server.provider"]["provider.list"]>[0]
type Endpoint8_0Input = { readonly location?: Endpoint8_0Request["query"]["location"] }
const Endpoint8_0 = (raw: RawClient["server.provider"]) => (input?: Endpoint8_0Input) =>
  raw["provider.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint8_1Request = Parameters<RawClient["server.provider"]["provider.get"]>[0]
type Endpoint8_1Input = {
  readonly providerID: Endpoint8_1Request["params"]["providerID"]
  readonly location?: Endpoint8_1Request["query"]["location"]
}
const Endpoint8_1 = (raw: RawClient["server.provider"]) => (input: Endpoint8_1Input) =>
  raw["provider.get"]({ params: { providerID: input["providerID"] }, query: { location: input["location"] } }).pipe(
    Effect.mapError(mapClientError),
  )

const adaptGroup8 = (raw: RawClient["server.provider"]) => ({ list: Endpoint8_0(raw), get: Endpoint8_1(raw) })

type Endpoint9_0Request = Parameters<RawClient["server.integration"]["integration.list"]>[0]
type Endpoint9_0Input = { readonly location?: Endpoint9_0Request["query"]["location"] }
const Endpoint9_0 = (raw: RawClient["server.integration"]) => (input?: Endpoint9_0Input) =>
  raw["integration.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint9_1Request = Parameters<RawClient["server.integration"]["integration.get"]>[0]
type Endpoint9_1Input = {
  readonly integrationID: Endpoint9_1Request["params"]["integrationID"]
  readonly location?: Endpoint9_1Request["query"]["location"]
}
const Endpoint9_1 = (raw: RawClient["server.integration"]) => (input: Endpoint9_1Input) =>
  raw["integration.get"]({
    params: { integrationID: input["integrationID"] },
    query: { location: input["location"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint9_2Request = Parameters<RawClient["server.integration"]["integration.connect.key"]>[0]
type Endpoint9_2Input = {
  readonly integrationID: Endpoint9_2Request["params"]["integrationID"]
  readonly location?: Endpoint9_2Request["query"]["location"]
  readonly key: Endpoint9_2Request["payload"]["key"]
  readonly label?: Endpoint9_2Request["payload"]["label"]
}
const Endpoint9_2 = (raw: RawClient["server.integration"]) => (input: Endpoint9_2Input) =>
  raw["integration.connect.key"]({
    params: { integrationID: input["integrationID"] },
    query: { location: input["location"] },
    payload: { key: input["key"], label: input["label"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint9_3Request = Parameters<RawClient["server.integration"]["integration.connect.oauth"]>[0]
type Endpoint9_3Input = {
  readonly integrationID: Endpoint9_3Request["params"]["integrationID"]
  readonly location?: Endpoint9_3Request["query"]["location"]
  readonly methodID: Endpoint9_3Request["payload"]["methodID"]
  readonly inputs: Endpoint9_3Request["payload"]["inputs"]
  readonly label?: Endpoint9_3Request["payload"]["label"]
}
const Endpoint9_3 = (raw: RawClient["server.integration"]) => (input: Endpoint9_3Input) =>
  raw["integration.connect.oauth"]({
    params: { integrationID: input["integrationID"] },
    query: { location: input["location"] },
    payload: { methodID: input["methodID"], inputs: input["inputs"], label: input["label"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint9_4Request = Parameters<RawClient["server.integration"]["integration.attempt.status"]>[0]
type Endpoint9_4Input = {
  readonly attemptID: Endpoint9_4Request["params"]["attemptID"]
  readonly location?: Endpoint9_4Request["query"]["location"]
}
const Endpoint9_4 = (raw: RawClient["server.integration"]) => (input: Endpoint9_4Input) =>
  raw["integration.attempt.status"]({
    params: { attemptID: input["attemptID"] },
    query: { location: input["location"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint9_5Request = Parameters<RawClient["server.integration"]["integration.attempt.complete"]>[0]
type Endpoint9_5Input = {
  readonly attemptID: Endpoint9_5Request["params"]["attemptID"]
  readonly location?: Endpoint9_5Request["query"]["location"]
  readonly code?: Endpoint9_5Request["payload"]["code"]
}
const Endpoint9_5 = (raw: RawClient["server.integration"]) => (input: Endpoint9_5Input) =>
  raw["integration.attempt.complete"]({
    params: { attemptID: input["attemptID"] },
    query: { location: input["location"] },
    payload: { code: input["code"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint9_6Request = Parameters<RawClient["server.integration"]["integration.attempt.cancel"]>[0]
type Endpoint9_6Input = {
  readonly attemptID: Endpoint9_6Request["params"]["attemptID"]
  readonly location?: Endpoint9_6Request["query"]["location"]
}
const Endpoint9_6 = (raw: RawClient["server.integration"]) => (input: Endpoint9_6Input) =>
  raw["integration.attempt.cancel"]({
    params: { attemptID: input["attemptID"] },
    query: { location: input["location"] },
  }).pipe(Effect.mapError(mapClientError))

const adaptGroup9 = (raw: RawClient["server.integration"]) => ({
  list: Endpoint9_0(raw),
  get: Endpoint9_1(raw),
  connectKey: Endpoint9_2(raw),
  connectOauth: Endpoint9_3(raw),
  attemptStatus: Endpoint9_4(raw),
  attemptComplete: Endpoint9_5(raw),
  attemptCancel: Endpoint9_6(raw),
})

type Endpoint10_0Request = Parameters<RawClient["server.mcp"]["mcp.list"]>[0]
type Endpoint10_0Input = { readonly location?: Endpoint10_0Request["query"]["location"] }
const Endpoint10_0 = (raw: RawClient["server.mcp"]) => (input?: Endpoint10_0Input) =>
  raw["mcp.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

const adaptGroup10 = (raw: RawClient["server.mcp"]) => ({ list: Endpoint10_0(raw) })

type Endpoint11_0Request = Parameters<RawClient["server.credential"]["credential.update"]>[0]
type Endpoint11_0Input = {
  readonly credentialID: Endpoint11_0Request["params"]["credentialID"]
  readonly location?: Endpoint11_0Request["query"]["location"]
  readonly label: Endpoint11_0Request["payload"]["label"]
}
const Endpoint11_0 = (raw: RawClient["server.credential"]) => (input: Endpoint11_0Input) =>
  raw["credential.update"]({
    params: { credentialID: input["credentialID"] },
    query: { location: input["location"] },
    payload: { label: input["label"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint11_1Request = Parameters<RawClient["server.credential"]["credential.remove"]>[0]
type Endpoint11_1Input = {
  readonly credentialID: Endpoint11_1Request["params"]["credentialID"]
  readonly location?: Endpoint11_1Request["query"]["location"]
}
const Endpoint11_1 = (raw: RawClient["server.credential"]) => (input: Endpoint11_1Input) =>
  raw["credential.remove"]({
    params: { credentialID: input["credentialID"] },
    query: { location: input["location"] },
  }).pipe(Effect.mapError(mapClientError))

const adaptGroup11 = (raw: RawClient["server.credential"]) => ({ update: Endpoint11_0(raw), remove: Endpoint11_1(raw) })

const Endpoint12_0 = (raw: RawClient["server.project"]) => () =>
  raw["project.list"]({}).pipe(Effect.mapError(mapClientError))

type Endpoint12_1Request = Parameters<RawClient["server.project"]["project.current"]>[0]
type Endpoint12_1Input = { readonly location?: Endpoint12_1Request["query"]["location"] }
const Endpoint12_1 = (raw: RawClient["server.project"]) => (input?: Endpoint12_1Input) =>
  raw["project.current"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint12_2Request = Parameters<RawClient["server.project"]["project.directories"]>[0]
type Endpoint12_2Input = {
  readonly projectID: Endpoint12_2Request["params"]["projectID"]
  readonly location?: Endpoint12_2Request["query"]["location"]
}
const Endpoint12_2 = (raw: RawClient["server.project"]) => (input: Endpoint12_2Input) =>
  raw["project.directories"]({
    params: { projectID: input["projectID"] },
    query: { location: input["location"] },
  }).pipe(Effect.mapError(mapClientError))

const adaptGroup12 = (raw: RawClient["server.project"]) => ({
  list: Endpoint12_0(raw),
  current: Endpoint12_1(raw),
  directories: Endpoint12_2(raw),
})

type Endpoint13_0Request = Parameters<RawClient["server.form"]["form.request.list"]>[0]
type Endpoint13_0Input = { readonly location?: Endpoint13_0Request["query"]["location"] }
const Endpoint13_0 = (raw: RawClient["server.form"]) => (input?: Endpoint13_0Input) =>
  raw["form.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint13_1Request = Parameters<RawClient["server.form"]["session.form.list"]>[0]
type Endpoint13_1Input = { readonly sessionID: Endpoint13_1Request["params"]["sessionID"] }
const Endpoint13_1 = (raw: RawClient["server.form"]) => (input: Endpoint13_1Input) =>
  raw["session.form.list"]({ params: { sessionID: input["sessionID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint13_2Request = Parameters<RawClient["server.form"]["session.form.create"]>[0]
type Endpoint13_2Input = {
  readonly sessionID: Endpoint13_2Request["params"]["sessionID"]
  readonly id?: Endpoint13_2Request["payload"]["id"]
  readonly title?: Endpoint13_2Request["payload"]["title"]
  readonly metadata?: Endpoint13_2Request["payload"]["metadata"]
  readonly mode: Endpoint13_2Request["payload"]["mode"]
  readonly fields?: Endpoint13_2Request["payload"]["fields"]
  readonly url?: Endpoint13_2Request["payload"]["url"]
}
const Endpoint13_2 = (raw: RawClient["server.form"]) => (input: Endpoint13_2Input) =>
  raw["session.form.create"]({
    params: { sessionID: input["sessionID"] },
    payload: {
      id: input["id"],
      title: input["title"],
      metadata: input["metadata"],
      mode: input["mode"],
      fields: input["fields"],
      url: input["url"],
    },
  }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint13_3Request = Parameters<RawClient["server.form"]["session.form.get"]>[0]
type Endpoint13_3Input = {
  readonly sessionID: Endpoint13_3Request["params"]["sessionID"]
  readonly formID: Endpoint13_3Request["params"]["formID"]
}
const Endpoint13_3 = (raw: RawClient["server.form"]) => (input: Endpoint13_3Input) =>
  raw["session.form.get"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint13_4Request = Parameters<RawClient["server.form"]["session.form.state"]>[0]
type Endpoint13_4Input = {
  readonly sessionID: Endpoint13_4Request["params"]["sessionID"]
  readonly formID: Endpoint13_4Request["params"]["formID"]
}
const Endpoint13_4 = (raw: RawClient["server.form"]) => (input: Endpoint13_4Input) =>
  raw["session.form.state"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint13_5Request = Parameters<RawClient["server.form"]["session.form.reply"]>[0]
type Endpoint13_5Input = {
  readonly sessionID: Endpoint13_5Request["params"]["sessionID"]
  readonly formID: Endpoint13_5Request["params"]["formID"]
  readonly answer: Endpoint13_5Request["payload"]["answer"]
}
const Endpoint13_5 = (raw: RawClient["server.form"]) => (input: Endpoint13_5Input) =>
  raw["session.form.reply"]({
    params: { sessionID: input["sessionID"], formID: input["formID"] },
    payload: { answer: input["answer"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint13_6Request = Parameters<RawClient["server.form"]["session.form.cancel"]>[0]
type Endpoint13_6Input = {
  readonly sessionID: Endpoint13_6Request["params"]["sessionID"]
  readonly formID: Endpoint13_6Request["params"]["formID"]
}
const Endpoint13_6 = (raw: RawClient["server.form"]) => (input: Endpoint13_6Input) =>
  raw["session.form.cancel"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(
    Effect.mapError(mapClientError),
  )

const adaptGroup13 = (raw: RawClient["server.form"]) => ({
  listRequests: Endpoint13_0(raw),
  list: Endpoint13_1(raw),
  create: Endpoint13_2(raw),
  get: Endpoint13_3(raw),
  state: Endpoint13_4(raw),
  reply: Endpoint13_5(raw),
  cancel: Endpoint13_6(raw),
})

type Endpoint14_0Request = Parameters<RawClient["server.permission"]["permission.request.list"]>[0]
type Endpoint14_0Input = { readonly location?: Endpoint14_0Request["query"]["location"] }
const Endpoint14_0 = (raw: RawClient["server.permission"]) => (input?: Endpoint14_0Input) =>
  raw["permission.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint14_1Request = Parameters<RawClient["server.permission"]["permission.saved.list"]>[0]
type Endpoint14_1Input = { readonly projectID?: Endpoint14_1Request["query"]["projectID"] }
const Endpoint14_1 = (raw: RawClient["server.permission"]) => (input?: Endpoint14_1Input) =>
  raw["permission.saved.list"]({ query: { projectID: input?.["projectID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint14_2Request = Parameters<RawClient["server.permission"]["permission.saved.remove"]>[0]
type Endpoint14_2Input = { readonly id: Endpoint14_2Request["params"]["id"] }
const Endpoint14_2 = (raw: RawClient["server.permission"]) => (input: Endpoint14_2Input) =>
  raw["permission.saved.remove"]({ params: { id: input["id"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint14_3Request = Parameters<RawClient["server.permission"]["session.permission.create"]>[0]
type Endpoint14_3Input = {
  readonly sessionID: Endpoint14_3Request["params"]["sessionID"]
  readonly id?: Endpoint14_3Request["payload"]["id"]
  readonly action: Endpoint14_3Request["payload"]["action"]
  readonly resources: Endpoint14_3Request["payload"]["resources"]
  readonly save?: Endpoint14_3Request["payload"]["save"]
  readonly metadata?: Endpoint14_3Request["payload"]["metadata"]
  readonly source?: Endpoint14_3Request["payload"]["source"]
  readonly agent?: Endpoint14_3Request["payload"]["agent"]
}
const Endpoint14_3 = (raw: RawClient["server.permission"]) => (input: Endpoint14_3Input) =>
  raw["session.permission.create"]({
    params: { sessionID: input["sessionID"] },
    payload: {
      id: input["id"],
      action: input["action"],
      resources: input["resources"],
      save: input["save"],
      metadata: input["metadata"],
      source: input["source"],
      agent: input["agent"],
    },
  }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint14_4Request = Parameters<RawClient["server.permission"]["session.permission.list"]>[0]
type Endpoint14_4Input = { readonly sessionID: Endpoint14_4Request["params"]["sessionID"] }
const Endpoint14_4 = (raw: RawClient["server.permission"]) => (input: Endpoint14_4Input) =>
  raw["session.permission.list"]({ params: { sessionID: input["sessionID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint14_5Request = Parameters<RawClient["server.permission"]["session.permission.get"]>[0]
type Endpoint14_5Input = {
  readonly sessionID: Endpoint14_5Request["params"]["sessionID"]
  readonly requestID: Endpoint14_5Request["params"]["requestID"]
}
const Endpoint14_5 = (raw: RawClient["server.permission"]) => (input: Endpoint14_5Input) =>
  raw["session.permission.get"]({ params: { sessionID: input["sessionID"], requestID: input["requestID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint14_6Request = Parameters<RawClient["server.permission"]["session.permission.reply"]>[0]
type Endpoint14_6Input = {
  readonly sessionID: Endpoint14_6Request["params"]["sessionID"]
  readonly requestID: Endpoint14_6Request["params"]["requestID"]
  readonly reply: Endpoint14_6Request["payload"]["reply"]
  readonly message?: Endpoint14_6Request["payload"]["message"]
}
const Endpoint14_6 = (raw: RawClient["server.permission"]) => (input: Endpoint14_6Input) =>
  raw["session.permission.reply"]({
    params: { sessionID: input["sessionID"], requestID: input["requestID"] },
    payload: { reply: input["reply"], message: input["message"] },
  }).pipe(Effect.mapError(mapClientError))

const adaptGroup14 = (raw: RawClient["server.permission"]) => ({
  listRequests: Endpoint14_0(raw),
  listSaved: Endpoint14_1(raw),
  removeSaved: Endpoint14_2(raw),
  create: Endpoint14_3(raw),
  list: Endpoint14_4(raw),
  get: Endpoint14_5(raw),
  reply: Endpoint14_6(raw),
})

type Endpoint15_0Request = Parameters<RawClient["server.fs"]["fs.list"]>[0]
type Endpoint15_0Input = {
  readonly location?: Endpoint15_0Request["query"]["location"]
  readonly path?: Endpoint15_0Request["query"]["path"]
}
const Endpoint15_0 = (raw: RawClient["server.fs"]) => (input?: Endpoint15_0Input) =>
  raw["fs.list"]({ query: { location: input?.["location"], path: input?.["path"] } }).pipe(
    Effect.mapError(mapClientError),
  )

type Endpoint15_1Request = Parameters<RawClient["server.fs"]["fs.find"]>[0]
type Endpoint15_1Input = {
  readonly location?: Endpoint15_1Request["query"]["location"]
  readonly query: Endpoint15_1Request["query"]["query"]
  readonly type?: Endpoint15_1Request["query"]["type"]
  readonly limit?: Endpoint15_1Request["query"]["limit"]
}
const Endpoint15_1 = (raw: RawClient["server.fs"]) => (input: Endpoint15_1Input) =>
  raw["fs.find"]({
    query: { location: input["location"], query: input["query"], type: input["type"], limit: input["limit"] },
  }).pipe(Effect.mapError(mapClientError))

const adaptGroup15 = (raw: RawClient["server.fs"]) => ({ list: Endpoint15_0(raw), find: Endpoint15_1(raw) })

type Endpoint16_0Request = Parameters<RawClient["server.command"]["command.list"]>[0]
type Endpoint16_0Input = { readonly location?: Endpoint16_0Request["query"]["location"] }
const Endpoint16_0 = (raw: RawClient["server.command"]) => (input?: Endpoint16_0Input) =>
  raw["command.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

const adaptGroup16 = (raw: RawClient["server.command"]) => ({ list: Endpoint16_0(raw) })

type Endpoint17_0Request = Parameters<RawClient["server.skill"]["skill.list"]>[0]
type Endpoint17_0Input = { readonly location?: Endpoint17_0Request["query"]["location"] }
const Endpoint17_0 = (raw: RawClient["server.skill"]) => (input?: Endpoint17_0Input) =>
  raw["skill.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

const adaptGroup17 = (raw: RawClient["server.skill"]) => ({ list: Endpoint17_0(raw) })

const Endpoint18_0 = (raw: RawClient["server.event"]) => () =>
  Stream.unwrap(
    raw["event.subscribe"]({}).pipe(
      Effect.mapError(mapClientError),
      Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError))),
    ),
  )

const Endpoint18_1 = (raw: RawClient["server.event"]) => () =>
  Stream.unwrap(
    raw["event.changes"]({}).pipe(
      Effect.mapError(mapClientError),
      Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError))),
    ),
  )

const adaptGroup18 = (raw: RawClient["server.event"]) => ({ subscribe: Endpoint18_0(raw), changes: Endpoint18_1(raw) })

type Endpoint19_0Request = Parameters<RawClient["server.pty"]["pty.list"]>[0]
type Endpoint19_0Input = { readonly location?: Endpoint19_0Request["query"]["location"] }
const Endpoint19_0 = (raw: RawClient["server.pty"]) => (input?: Endpoint19_0Input) =>
  raw["pty.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint19_1Request = Parameters<RawClient["server.pty"]["pty.create"]>[0]
type Endpoint19_1Input = {
  readonly location?: Endpoint19_1Request["query"]["location"]
  readonly command?: Endpoint19_1Request["payload"]["command"]
  readonly args?: Endpoint19_1Request["payload"]["args"]
  readonly cwd?: Endpoint19_1Request["payload"]["cwd"]
  readonly title?: Endpoint19_1Request["payload"]["title"]
  readonly env?: Endpoint19_1Request["payload"]["env"]
}
const Endpoint19_1 = (raw: RawClient["server.pty"]) => (input?: Endpoint19_1Input) =>
  raw["pty.create"]({
    query: { location: input?.["location"] },
    payload: {
      command: input?.["command"],
      args: input?.["args"],
      cwd: input?.["cwd"],
      title: input?.["title"],
      env: input?.["env"],
    },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint19_2Request = Parameters<RawClient["server.pty"]["pty.get"]>[0]
type Endpoint19_2Input = {
  readonly ptyID: Endpoint19_2Request["params"]["ptyID"]
  readonly location?: Endpoint19_2Request["query"]["location"]
}
const Endpoint19_2 = (raw: RawClient["server.pty"]) => (input: Endpoint19_2Input) =>
  raw["pty.get"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] } }).pipe(
    Effect.mapError(mapClientError),
  )

type Endpoint19_3Request = Parameters<RawClient["server.pty"]["pty.update"]>[0]
type Endpoint19_3Input = {
  readonly ptyID: Endpoint19_3Request["params"]["ptyID"]
  readonly location?: Endpoint19_3Request["query"]["location"]
  readonly title?: Endpoint19_3Request["payload"]["title"]
  readonly size?: Endpoint19_3Request["payload"]["size"]
}
const Endpoint19_3 = (raw: RawClient["server.pty"]) => (input: Endpoint19_3Input) =>
  raw["pty.update"]({
    params: { ptyID: input["ptyID"] },
    query: { location: input["location"] },
    payload: { title: input["title"], size: input["size"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint19_4Request = Parameters<RawClient["server.pty"]["pty.remove"]>[0]
type Endpoint19_4Input = {
  readonly ptyID: Endpoint19_4Request["params"]["ptyID"]
  readonly location?: Endpoint19_4Request["query"]["location"]
}
const Endpoint19_4 = (raw: RawClient["server.pty"]) => (input: Endpoint19_4Input) =>
  raw["pty.remove"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] } }).pipe(
    Effect.mapError(mapClientError),
  )

const adaptGroup19 = (raw: RawClient["server.pty"]) => ({
  list: Endpoint19_0(raw),
  create: Endpoint19_1(raw),
  get: Endpoint19_2(raw),
  update: Endpoint19_3(raw),
  remove: Endpoint19_4(raw),
})

type Endpoint20_0Request = Parameters<RawClient["server.shell"]["shell.list"]>[0]
type Endpoint20_0Input = { readonly location?: Endpoint20_0Request["query"]["location"] }
const Endpoint20_0 = (raw: RawClient["server.shell"]) => (input?: Endpoint20_0Input) =>
  raw["shell.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint20_1Request = Parameters<RawClient["server.shell"]["shell.create"]>[0]
type Endpoint20_1Input = {
  readonly location?: Endpoint20_1Request["query"]["location"]
  readonly command: Endpoint20_1Request["payload"]["command"]
  readonly cwd?: Endpoint20_1Request["payload"]["cwd"]
  readonly timeout?: Endpoint20_1Request["payload"]["timeout"]
  readonly metadata?: Endpoint20_1Request["payload"]["metadata"]
}
const Endpoint20_1 = (raw: RawClient["server.shell"]) => (input: Endpoint20_1Input) =>
  raw["shell.create"]({
    query: { location: input["location"] },
    payload: { command: input["command"], cwd: input["cwd"], timeout: input["timeout"], metadata: input["metadata"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint20_2Request = Parameters<RawClient["server.shell"]["shell.get"]>[0]
type Endpoint20_2Input = {
  readonly id: Endpoint20_2Request["params"]["id"]
  readonly location?: Endpoint20_2Request["query"]["location"]
}
const Endpoint20_2 = (raw: RawClient["server.shell"]) => (input: Endpoint20_2Input) =>
  raw["shell.get"]({ params: { id: input["id"] }, query: { location: input["location"] } }).pipe(
    Effect.mapError(mapClientError),
  )

type Endpoint20_3Request = Parameters<RawClient["server.shell"]["shell.output"]>[0]
type Endpoint20_3Input = {
  readonly id: Endpoint20_3Request["params"]["id"]
  readonly location?: Endpoint20_3Request["query"]["location"]
  readonly cursor?: Endpoint20_3Request["query"]["cursor"]
  readonly limit?: Endpoint20_3Request["query"]["limit"]
}
const Endpoint20_3 = (raw: RawClient["server.shell"]) => (input: Endpoint20_3Input) =>
  raw["shell.output"]({
    params: { id: input["id"] },
    query: { location: input["location"], cursor: input["cursor"], limit: input["limit"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint20_4Request = Parameters<RawClient["server.shell"]["shell.remove"]>[0]
type Endpoint20_4Input = {
  readonly id: Endpoint20_4Request["params"]["id"]
  readonly location?: Endpoint20_4Request["query"]["location"]
}
const Endpoint20_4 = (raw: RawClient["server.shell"]) => (input: Endpoint20_4Input) =>
  raw["shell.remove"]({ params: { id: input["id"] }, query: { location: input["location"] } }).pipe(
    Effect.mapError(mapClientError),
  )

const adaptGroup20 = (raw: RawClient["server.shell"]) => ({
  list: Endpoint20_0(raw),
  create: Endpoint20_1(raw),
  get: Endpoint20_2(raw),
  output: Endpoint20_3(raw),
  remove: Endpoint20_4(raw),
})

type Endpoint21_0Request = Parameters<RawClient["server.question"]["question.request.list"]>[0]
type Endpoint21_0Input = { readonly location?: Endpoint21_0Request["query"]["location"] }
const Endpoint21_0 = (raw: RawClient["server.question"]) => (input?: Endpoint21_0Input) =>
  raw["question.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint21_1Request = Parameters<RawClient["server.question"]["session.question.list"]>[0]
type Endpoint21_1Input = { readonly sessionID: Endpoint21_1Request["params"]["sessionID"] }
const Endpoint21_1 = (raw: RawClient["server.question"]) => (input: Endpoint21_1Input) =>
  raw["session.question.list"]({ params: { sessionID: input["sessionID"] } }).pipe(
    Effect.mapError(mapClientError),
    Effect.map((value) => value.data),
  )

type Endpoint21_2Request = Parameters<RawClient["server.question"]["session.question.reply"]>[0]
type Endpoint21_2Input = {
  readonly sessionID: Endpoint21_2Request["params"]["sessionID"]
  readonly requestID: Endpoint21_2Request["params"]["requestID"]
  readonly answers: Endpoint21_2Request["payload"]["answers"]
}
const Endpoint21_2 = (raw: RawClient["server.question"]) => (input: Endpoint21_2Input) =>
  raw["session.question.reply"]({
    params: { sessionID: input["sessionID"], requestID: input["requestID"] },
    payload: { answers: input["answers"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint21_3Request = Parameters<RawClient["server.question"]["session.question.reject"]>[0]
type Endpoint21_3Input = {
  readonly sessionID: Endpoint21_3Request["params"]["sessionID"]
  readonly requestID: Endpoint21_3Request["params"]["requestID"]
}
const Endpoint21_3 = (raw: RawClient["server.question"]) => (input: Endpoint21_3Input) =>
  raw["session.question.reject"]({ params: { sessionID: input["sessionID"], requestID: input["requestID"] } }).pipe(
    Effect.mapError(mapClientError),
  )

const adaptGroup21 = (raw: RawClient["server.question"]) => ({
  listRequests: Endpoint21_0(raw),
  list: Endpoint21_1(raw),
  reply: Endpoint21_2(raw),
  reject: Endpoint21_3(raw),
})

type Endpoint22_0Request = Parameters<RawClient["server.reference"]["reference.list"]>[0]
type Endpoint22_0Input = { readonly location?: Endpoint22_0Request["query"]["location"] }
const Endpoint22_0 = (raw: RawClient["server.reference"]) => (input?: Endpoint22_0Input) =>
  raw["reference.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

const adaptGroup22 = (raw: RawClient["server.reference"]) => ({ list: Endpoint22_0(raw) })

type Endpoint23_0Request = Parameters<RawClient["server.projectCopy"]["projectCopy.create"]>[0]
type Endpoint23_0Input = {
  readonly projectID: Endpoint23_0Request["params"]["projectID"]
  readonly location?: Endpoint23_0Request["query"]["location"]
  readonly strategy: Endpoint23_0Request["payload"]["strategy"]
  readonly directory: Endpoint23_0Request["payload"]["directory"]
  readonly name?: Endpoint23_0Request["payload"]["name"]
}
const Endpoint23_0 = (raw: RawClient["server.projectCopy"]) => (input: Endpoint23_0Input) =>
  raw["projectCopy.create"]({
    params: { projectID: input["projectID"] },
    query: { location: input["location"] },
    payload: { strategy: input["strategy"], directory: input["directory"], name: input["name"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint23_1Request = Parameters<RawClient["server.projectCopy"]["projectCopy.remove"]>[0]
type Endpoint23_1Input = {
  readonly projectID: Endpoint23_1Request["params"]["projectID"]
  readonly location?: Endpoint23_1Request["query"]["location"]
  readonly directory: Endpoint23_1Request["payload"]["directory"]
  readonly force: Endpoint23_1Request["payload"]["force"]
}
const Endpoint23_1 = (raw: RawClient["server.projectCopy"]) => (input: Endpoint23_1Input) =>
  raw["projectCopy.remove"]({
    params: { projectID: input["projectID"] },
    query: { location: input["location"] },
    payload: { directory: input["directory"], force: input["force"] },
  }).pipe(Effect.mapError(mapClientError))

type Endpoint23_2Request = Parameters<RawClient["server.projectCopy"]["projectCopy.refresh"]>[0]
type Endpoint23_2Input = {
  readonly projectID: Endpoint23_2Request["params"]["projectID"]
  readonly location?: Endpoint23_2Request["query"]["location"]
}
const Endpoint23_2 = (raw: RawClient["server.projectCopy"]) => (input: Endpoint23_2Input) =>
  raw["projectCopy.refresh"]({
    params: { projectID: input["projectID"] },
    query: { location: input["location"] },
  }).pipe(Effect.mapError(mapClientError))

const adaptGroup23 = (raw: RawClient["server.projectCopy"]) => ({
  create: Endpoint23_0(raw),
  remove: Endpoint23_1(raw),
  refresh: Endpoint23_2(raw),
})

type Endpoint24_0Request = Parameters<RawClient["server.vcs"]["vcs.status"]>[0]
type Endpoint24_0Input = { readonly location?: Endpoint24_0Request["query"]["location"] }
const Endpoint24_0 = (raw: RawClient["server.vcs"]) => (input?: Endpoint24_0Input) =>
  raw["vcs.status"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError))

type Endpoint24_1Request = Parameters<RawClient["server.vcs"]["vcs.diff"]>[0]
type Endpoint24_1Input = {
  readonly location?: Endpoint24_1Request["query"]["location"]
  readonly mode: Endpoint24_1Request["query"]["mode"]
  readonly context?: Endpoint24_1Request["query"]["context"]
}
const Endpoint24_1 = (raw: RawClient["server.vcs"]) => (input: Endpoint24_1Input) =>
  raw["vcs.diff"]({ query: { location: input["location"], mode: input["mode"], context: input["context"] } }).pipe(
    Effect.mapError(mapClientError),
  )

const adaptGroup24 = (raw: RawClient["server.vcs"]) => ({ status: Endpoint24_0(raw), diff: Endpoint24_1(raw) })

const Endpoint25_0 = (raw: RawClient["server.debug"]) => () =>
  raw["debug.location"]({}).pipe(Effect.mapError(mapClientError))

const adaptGroup25 = (raw: RawClient["server.debug"]) => ({ location: Endpoint25_0(raw) })

const adaptClient = (raw: RawClient) => ({
  health: adaptGroup0(raw["server.health"]),
  location: adaptGroup1(raw["server.location"]),
  agent: adaptGroup2(raw["server.agent"]),
  plugin: adaptGroup3(raw["server.plugin"]),
  session: adaptGroup4(raw["server.session"]),
  message: adaptGroup5(raw["server.message"]),
  model: adaptGroup6(raw["server.model"]),
  generate: adaptGroup7(raw["server.generate"]),
  provider: adaptGroup8(raw["server.provider"]),
  integration: adaptGroup9(raw["server.integration"]),
  "server.mcp": adaptGroup10(raw["server.mcp"]),
  credential: adaptGroup11(raw["server.credential"]),
  project: adaptGroup12(raw["server.project"]),
  form: adaptGroup13(raw["server.form"]),
  permission: adaptGroup14(raw["server.permission"]),
  file: adaptGroup15(raw["server.fs"]),
  command: adaptGroup16(raw["server.command"]),
  skill: adaptGroup17(raw["server.skill"]),
  event: adaptGroup18(raw["server.event"]),
  pty: adaptGroup19(raw["server.pty"]),
  shell: adaptGroup20(raw["server.shell"]),
  question: adaptGroup21(raw["server.question"]),
  reference: adaptGroup22(raw["server.reference"]),
  projectCopy: adaptGroup23(raw["server.projectCopy"]),
  vcs: adaptGroup24(raw["server.vcs"]),
  debug: adaptGroup25(raw["server.debug"]),
})

export const make = (options?: { readonly baseUrl?: URL | string }) =>
  HttpApiClient.make(ClientApi, options).pipe(Effect.map(adaptClient))
