// Generated by @opencode/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 type { ServerInfoOutput, LocationGetInput, LocationGetOutput, LocationReloadOutput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, PluginUpdateOutput, SessionListInput, SessionListOutput, SessionStatsInput, SessionStatsOutput, SessionCreateInput, SessionCreateOutput, SessionImportInput, SessionImportOutput, SessionExportInput, SessionExportOutput, SessionActiveOutput, SessionGetInput, SessionGetOutput, SessionRemoveInput, SessionRemoveOutput, SessionForkInput, SessionForkOutput, SessionSwitchAgentInput, SessionSwitchAgentOutput, SessionSwitchModelInput, SessionSwitchModelOutput, SessionUpdateInput, SessionUpdateOutput, SessionMoveInput, SessionMoveOutput, SessionPromptInput, SessionPromptOutput, SessionCommandInput, SessionCommandOutput, SessionSkillInput, SessionSkillOutput, SessionSyntheticInput, SessionSyntheticOutput, SessionShellInput, SessionShellOutput, SessionCompactInput, SessionCompactOutput, SessionWaitInput, SessionWaitOutput, SessionRevertStageInput, SessionRevertStageOutput, SessionRevertClearInput, SessionRevertClearOutput, SessionRevertCommitInput, SessionRevertCommitOutput, SessionContextInput, SessionContextOutput, SessionDiffInput, SessionDiffOutput, SessionInboxListInput, SessionInboxListOutput, SessionInboxCancelInput, SessionInboxCancelOutput, SessionInboxUpdateInput, SessionInboxUpdateOutput, SessionInstructionsEntryListInput, SessionInstructionsEntryListOutput, SessionInstructionsEntryPutInput, SessionInstructionsEntryPutOutput, SessionInstructionsEntryRemoveInput, SessionInstructionsEntryRemoveOutput, SessionGenerateInput, SessionGenerateOutput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionInterruptOutput, SessionBackgroundInput, SessionBackgroundOutput, SessionMessageGetInput, SessionMessageGetOutput, SessionFormListInput, SessionFormListOutput, SessionFormCreateInput, SessionFormCreateOutput, SessionFormGetInput, SessionFormGetOutput, SessionFormReplyInput, SessionFormReplyOutput, SessionFormCancelInput, SessionFormCancelOutput, SessionEnvironmentInput, SessionEnvironmentOutput, SessionViewInput, SessionViewOutput, MessageListInput, MessageListOutput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, GenerateTextInput, GenerateTextOutput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationWellknownAddInput, IntegrationWellknownAddOutput, IntegrationConnectKeyInput, IntegrationConnectKeyOutput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCompleteOutput, IntegrationOauthCancelInput, IntegrationOauthCancelOutput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, IntegrationCommandCancelOutput, McpListInput, McpListOutput, McpAddInput, McpAddOutput, McpRemoveInput, McpRemoveOutput, McpConnectInput, McpConnectOutput, McpDisconnectInput, McpDisconnectOutput, McpResourceCatalogInput, McpResourceCatalogOutput, CredentialUpdateInput, CredentialUpdateOutput, CredentialActivateInput, CredentialActivateOutput, CredentialRemoveInput, CredentialRemoveOutput, ProjectListOutput, ProjectUpdateInput, ProjectUpdateOutput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedListOutput, PermissionSavedRemoveInput, PermissionSavedRemoveOutput, PermissionCreateInput, PermissionCreateOutput, PermissionListInput, PermissionListOutput, PermissionGetInput, PermissionGetOutput, PermissionReplyInput, PermissionReplyOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, RpcCallOutput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyRemoveOutput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyReadOutput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyListOutput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyCreateOutput, ExperimentalPersistentPtyShutdownOutput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyGetOutput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtyUpdateOutput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtySnapshotOutput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyRemoveOutput, ExperimentalPersistentPtyConnectTokenInput, ExperimentalPersistentPtyConnectTokenOutput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ShellRemoveOutput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeListOutput, WorktreeCreateInput, WorktreeCreateOutput, WorktreeRemoveInput, WorktreeRemoveOutput, WorktreeRefreshInput, WorktreeRefreshOutput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, DebugLocationEvictOutput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ConfigUpdateInput, ConfigUpdateOutput, } from "../api/api.js" import { ClientError } from "./client-error.js" type RawClient = HttpApiClient.ForApi const mapClientError = (error: E) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error) ? new ClientError({ cause: error }) : error const preserveEffect = () => (effect: Effect.Effect) => effect const preserveStream = () => (stream: Stream.Stream) => stream const EndpointServerInfo = (raw: RawClient["server.server"]) => () => preserveEffect()(raw["server.info"]({}).pipe(Effect.mapError(mapClientError))) const adaptGroupServer = (raw: RawClient["server.server"]) => ({ info: EndpointServerInfo(raw) }) const EndpointLocationGet = (raw: RawClient["server.location"]) => (input?: LocationGetInput) => preserveEffect()( raw["location.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointLocationReload = (raw: RawClient["server.location"]) => () => preserveEffect()(raw["location.reload"]({}).pipe(Effect.mapError(mapClientError))) const adaptGroupLocation = (raw: RawClient["server.location"]) => ({ get: EndpointLocationGet(raw), reload: EndpointLocationReload(raw), }) const EndpointAgentList = (raw: RawClient["server.agent"]) => (input?: AgentListInput) => preserveEffect()( raw["agent.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointAgentGet = (raw: RawClient["server.agent"]) => (input: AgentGetInput) => preserveEffect()( raw["agent.get"]({ params: { agentID: input["agentID"] }, query: { location: input["location"] } }).pipe( Effect.mapError(mapClientError), ), ) const adaptGroupAgent = (raw: RawClient["server.agent"]) => ({ list: EndpointAgentList(raw), get: EndpointAgentGet(raw), }) const EndpointPluginList = (raw: RawClient["server.plugin"]) => (input?: PluginListInput) => preserveEffect()( raw["plugin.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointPluginCheck = (raw: RawClient["server.plugin"]) => (input?: PluginCheckInput) => preserveEffect()( raw["plugin.check"]({ query: { location: input?.["location"] }, payload: { target: input?.["target"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointPluginUpdate = (raw: RawClient["server.plugin"]) => (input: PluginUpdateInput) => preserveEffect()( raw["plugin.update"]({ query: { location: input["location"] }, payload: { targets: input["targets"] } }).pipe( Effect.mapError(mapClientError), ), ) const adaptGroupPlugin = (raw: RawClient["server.plugin"]) => ({ list: EndpointPluginList(raw), check: EndpointPluginCheck(raw), update: EndpointPluginUpdate(raw), }) const EndpointSessionList = (raw: RawClient["server.session"]) => (input?: SessionListInput) => preserveEffect()( raw["session.list"]({ query: { 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)), ) const EndpointSessionStats = (raw: RawClient["server.session"]) => (input?: SessionStatsInput) => preserveEffect()( raw["session.stats"]({ query: { from: input?.["from"], to: input?.["to"], project: input?.["project"], timezone: input?.["timezone"], tools: input?.["tools"], }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionCreate = (raw: RawClient["server.session"]) => (input?: SessionCreateInput) => preserveEffect()( raw["session.create"]({ payload: { id: input?.["id"], title: input?.["title"], agent: input?.["agent"], model: input?.["model"], location: input?.["location"], metadata: input?.["metadata"], permissions: input?.["permissions"], }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionImport = (raw: RawClient["server.session"]) => (input: SessionImportInput) => preserveEffect()( raw["session.import"]({ payload: { info: input["info"], messages: input["messages"], location: input["location"] }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionExport = (raw: RawClient["server.session"]) => (input: SessionExportInput) => preserveEffect()( raw["session.export"]({ params: { sessionID: input["sessionID"] }, query: { sanitize: input["sanitize"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionActive = (raw: RawClient["server.session"]) => () => preserveEffect()( raw["session.active"]({}).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionGet = (raw: RawClient["server.session"]) => (input: SessionGetInput) => preserveEffect()( raw["session.get"]({ params: { sessionID: input["sessionID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionRemove = (raw: RawClient["server.session"]) => (input: SessionRemoveInput) => preserveEffect()( raw["session.remove"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionFork = (raw: RawClient["server.session"]) => (input: SessionForkInput) => preserveEffect()( raw["session.fork"]({ params: { sessionID: input["sessionID"] }, payload: { before: input["before"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionSwitchAgent = (raw: RawClient["server.session"]) => (input: SessionSwitchAgentInput) => preserveEffect()( raw["session.switchAgent"]({ params: { sessionID: input["sessionID"] }, payload: { agent: input["agent"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointSessionSwitchModel = (raw: RawClient["server.session"]) => (input: SessionSwitchModelInput) => preserveEffect()( raw["session.switchModel"]({ params: { sessionID: input["sessionID"] }, payload: { model: input["model"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointSessionUpdate = (raw: RawClient["server.session"]) => (input: SessionUpdateInput) => preserveEffect()( raw["session.update"]({ params: { sessionID: input["sessionID"] }, payload: { title: input["title"], permissions: input["permissions"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionMove = (raw: RawClient["server.session"]) => (input: SessionMoveInput) => preserveEffect()( raw["session.move"]({ params: { sessionID: input["sessionID"] }, payload: { directory: input["directory"], delivery: input["delivery"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionPrompt = (raw: RawClient["server.session"]) => (input: SessionPromptInput) => preserveEffect()( raw["session.prompt"]({ params: { sessionID: input["sessionID"] }, payload: { id: input["id"], text: input["text"], files: input["files"], agents: input["agents"], skills: input["skills"], metadata: input["metadata"], delivery: input["delivery"], resume: input["resume"], }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionCommand = (raw: RawClient["server.session"]) => (input: SessionCommandInput) => preserveEffect()( raw["session.command"]({ params: { sessionID: input["sessionID"] }, payload: { name: input["name"], text: input["text"], files: input["files"], agents: input["agents"], skills: input["skills"], delivery: input["delivery"], }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionSkill = (raw: RawClient["server.session"]) => (input: SessionSkillInput) => preserveEffect()( raw["session.skill"]({ params: { sessionID: input["sessionID"] }, payload: { id: input["id"], resume: input["resume"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionSynthetic = (raw: RawClient["server.session"]) => (input: SessionSyntheticInput) => preserveEffect()( raw["session.synthetic"]({ params: { sessionID: input["sessionID"] }, payload: { id: input["id"], text: input["text"], description: input["description"], metadata: input["metadata"], delivery: input["delivery"], resume: input["resume"], }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionShell = (raw: RawClient["server.session"]) => (input: SessionShellInput) => preserveEffect()( raw["session.shell"]({ params: { sessionID: input["sessionID"] }, payload: { id: input["id"], command: input["command"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionCompact = (raw: RawClient["server.session"]) => (input: SessionCompactInput) => preserveEffect()( raw["session.compact"]({ params: { sessionID: input["sessionID"] }, payload: { id: input["id"], delivery: input["delivery"] }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionWait = (raw: RawClient["server.session"]) => (input: SessionWaitInput) => preserveEffect()( raw["session.wait"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionRevertStage = (raw: RawClient["server.session"]) => (input: SessionRevertStageInput) => preserveEffect()( raw["session.revert.stage"]({ params: { sessionID: input["sessionID"] }, payload: { messageID: input["messageID"], files: input["files"] }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionRevertClear = (raw: RawClient["server.session"]) => (input: SessionRevertClearInput) => preserveEffect()( raw["session.revert.clear"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionRevertCommit = (raw: RawClient["server.session"]) => (input: SessionRevertCommitInput) => preserveEffect()( raw["session.revert.commit"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionContext = (raw: RawClient["server.session"]) => (input: SessionContextInput) => preserveEffect()( raw["session.context"]({ params: { sessionID: input["sessionID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionDiff = (raw: RawClient["server.session"]) => (input: SessionDiffInput) => preserveEffect()( raw["session.diff"]({ params: { sessionID: input["sessionID"] }, query: { from: input["from"], to: input["to"], context: input["context"] }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionInboxList = (raw: RawClient["server.session"]) => (input: SessionInboxListInput) => preserveEffect()( raw["session.inbox.list"]({ params: { sessionID: input["sessionID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionInboxCancel = (raw: RawClient["server.session"]) => (input: SessionInboxCancelInput) => preserveEffect()( raw["session.inbox.cancel"]({ params: { sessionID: input["sessionID"], inboxID: input["inboxID"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointSessionInboxUpdate = (raw: RawClient["server.session"]) => (input: SessionInboxUpdateInput) => preserveEffect()( raw["session.inbox.update"]({ params: { sessionID: input["sessionID"], inboxID: input["inboxID"] }, payload: { delivery: input["delivery"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionInstructionsEntryList = (raw: RawClient["server.session"]) => (input: SessionInstructionsEntryListInput) => preserveEffect()( raw["session.instructions.entry.list"]({ params: { sessionID: input["sessionID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionInstructionsEntryPut = (raw: RawClient["server.session"]) => (input: SessionInstructionsEntryPutInput) => preserveEffect()( raw["session.instructions.entry.put"]({ params: { sessionID: input["sessionID"], key: input["key"] }, payload: { value: input["value"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionInstructionsEntryRemove = (raw: RawClient["server.session"]) => (input: SessionInstructionsEntryRemoveInput) => preserveEffect()( raw["session.instructions.entry.remove"]({ params: { sessionID: input["sessionID"], key: input["key"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointSessionGenerate = (raw: RawClient["server.session"]) => (input: SessionGenerateInput) => preserveEffect()( raw["session.generate"]({ params: { sessionID: input["sessionID"] }, payload: { prompt: input["prompt"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionLog = (raw: RawClient["server.session"]) => (input: SessionLogInput) => preserveStream()( 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))), ), ), ) const EndpointSessionInterrupt = (raw: RawClient["server.session"]) => (input: SessionInterruptInput) => preserveEffect()( raw["session.interrupt"]({ params: { sessionID: input["sessionID"] }, query: { resume: input["resume"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointSessionBackground = (raw: RawClient["server.session"]) => (input: SessionBackgroundInput) => preserveEffect()( raw["session.background"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionMessageGet = (raw: RawClient["server.session"]) => (input: SessionMessageGetInput) => preserveEffect()( raw["session.message"]({ params: { sessionID: input["sessionID"], messageID: input["messageID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionFormList = (raw: RawClient["server.session"]) => (input: SessionFormListInput) => preserveEffect()( raw["session.form.list"]({ params: { sessionID: input["sessionID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionFormCreate = (raw: RawClient["server.session"]) => (input: SessionFormCreateInput) => preserveEffect()( raw["session.form.create"]({ params: { sessionID: input["sessionID"] }, payload: { id: input["id"], title: input["title"], metadata: input["metadata"], fields: input["fields"] }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionFormGet = (raw: RawClient["server.session"]) => (input: SessionFormGetInput) => preserveEffect()( raw["session.form.get"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointSessionFormReply = (raw: RawClient["server.session"]) => (input: SessionFormReplyInput) => preserveEffect()( raw["session.form.reply"]({ params: { sessionID: input["sessionID"], formID: input["formID"] }, payload: { answer: input["answer"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionFormCancel = (raw: RawClient["server.session"]) => (input: SessionFormCancelInput) => preserveEffect()( raw["session.form.cancel"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointSessionEnvironment = (raw: RawClient["server.session"]) => (input: SessionEnvironmentInput) => preserveEffect()( raw["session.environment"]({ params: { sessionID: input["sessionID"] }, payload: { variables: input["variables"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointSessionView = (raw: RawClient["server.session"]) => (input: SessionViewInput) => preserveEffect()( raw["session.view"]({ params: { sessionID: input["sessionID"] }, payload: { idle: input["idle"] } }).pipe( Effect.mapError(mapClientError), ), ) const adaptGroupSession = (raw: RawClient["server.session"]) => ({ list: EndpointSessionList(raw), stats: EndpointSessionStats(raw), create: EndpointSessionCreate(raw), import: EndpointSessionImport(raw), export: EndpointSessionExport(raw), active: EndpointSessionActive(raw), get: EndpointSessionGet(raw), remove: EndpointSessionRemove(raw), fork: EndpointSessionFork(raw), switchAgent: EndpointSessionSwitchAgent(raw), switchModel: EndpointSessionSwitchModel(raw), update: EndpointSessionUpdate(raw), move: EndpointSessionMove(raw), prompt: EndpointSessionPrompt(raw), command: EndpointSessionCommand(raw), skill: EndpointSessionSkill(raw), synthetic: EndpointSessionSynthetic(raw), shell: EndpointSessionShell(raw), compact: EndpointSessionCompact(raw), wait: EndpointSessionWait(raw), revert: { stage: EndpointSessionRevertStage(raw), clear: EndpointSessionRevertClear(raw), commit: EndpointSessionRevertCommit(raw), }, context: EndpointSessionContext(raw), diff: EndpointSessionDiff(raw), inbox: { list: EndpointSessionInboxList(raw), cancel: EndpointSessionInboxCancel(raw), update: EndpointSessionInboxUpdate(raw), }, instructions: { entry: { list: EndpointSessionInstructionsEntryList(raw), put: EndpointSessionInstructionsEntryPut(raw), remove: EndpointSessionInstructionsEntryRemove(raw), }, }, generate: EndpointSessionGenerate(raw), log: EndpointSessionLog(raw), interrupt: EndpointSessionInterrupt(raw), background: EndpointSessionBackground(raw), message: { get: EndpointSessionMessageGet(raw) }, form: { list: EndpointSessionFormList(raw), create: EndpointSessionFormCreate(raw), get: EndpointSessionFormGet(raw), reply: EndpointSessionFormReply(raw), cancel: EndpointSessionFormCancel(raw), }, environment: EndpointSessionEnvironment(raw), view: EndpointSessionView(raw), }) const EndpointMessageList = (raw: RawClient["server.message"]) => (input: MessageListInput) => preserveEffect()( raw["session.messages"]({ params: { sessionID: input["sessionID"] }, query: { limit: input["limit"], order: input["order"], cursor: input["cursor"], type: input["type"] }, }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupMessage = (raw: RawClient["server.message"]) => ({ list: EndpointMessageList(raw) }) const EndpointModelList = (raw: RawClient["server.model"]) => (input?: ModelListInput) => preserveEffect()( raw["model.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointModelDefault = (raw: RawClient["server.model"]) => (input?: ModelDefaultInput) => preserveEffect()( raw["model.default"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupModel = (raw: RawClient["server.model"]) => ({ list: EndpointModelList(raw), default: EndpointModelDefault(raw), }) const EndpointGenerateText = (raw: RawClient["server.generate"]) => (input: GenerateTextInput) => preserveEffect()( raw["generate.text"]({ payload: { prompt: input["prompt"], model: input["model"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const adaptGroupGenerate = (raw: RawClient["server.generate"]) => ({ text: EndpointGenerateText(raw) }) const EndpointProviderList = (raw: RawClient["server.provider"]) => (input?: ProviderListInput) => preserveEffect()( raw["provider.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointProviderGet = (raw: RawClient["server.provider"]) => (input: ProviderGetInput) => preserveEffect()( raw["provider.get"]({ params: { providerID: input["providerID"] }, query: { location: input["location"] } }).pipe( Effect.mapError(mapClientError), ), ) const adaptGroupProvider = (raw: RawClient["server.provider"]) => ({ list: EndpointProviderList(raw), get: EndpointProviderGet(raw), }) const EndpointIntegrationList = (raw: RawClient["server.integration"]) => (input?: IntegrationListInput) => preserveEffect()( raw["integration.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointIntegrationGet = (raw: RawClient["server.integration"]) => (input: IntegrationGetInput) => preserveEffect()( raw["integration.get"]({ params: { integrationID: input["integrationID"] }, query: { location: input["location"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointIntegrationWellknownAdd = (raw: RawClient["server.integration"]) => (input: IntegrationWellknownAddInput) => preserveEffect()( raw["integration.wellknown.add"]({ query: { location: input["location"] }, payload: { url: input["url"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointIntegrationConnectKey = (raw: RawClient["server.integration"]) => (input: IntegrationConnectKeyInput) => preserveEffect()( raw["integration.connect.key"]({ params: { integrationID: input["integrationID"] }, query: { location: input["location"] }, payload: { key: input["key"], answer: input["answer"], label: input["label"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointIntegrationOauthConnect = (raw: RawClient["server.integration"]) => (input: IntegrationOauthConnectInput) => preserveEffect()( raw["integration.oauth.connect"]({ params: { integrationID: input["integrationID"] }, query: { location: input["location"] }, payload: { methodID: input["methodID"], answer: input["answer"], label: input["label"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointIntegrationOauthStatus = (raw: RawClient["server.integration"]) => (input: IntegrationOauthStatusInput) => preserveEffect()( raw["integration.oauth.status"]({ params: { integrationID: input["integrationID"], attemptID: input["attemptID"] }, query: { location: input["location"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointIntegrationOauthComplete = (raw: RawClient["server.integration"]) => (input: IntegrationOauthCompleteInput) => preserveEffect()( raw["integration.oauth.complete"]({ params: { integrationID: input["integrationID"], attemptID: input["attemptID"] }, query: { location: input["location"] }, payload: { code: input["code"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointIntegrationOauthCancel = (raw: RawClient["server.integration"]) => (input: IntegrationOauthCancelInput) => preserveEffect()( raw["integration.oauth.cancel"]({ params: { integrationID: input["integrationID"], attemptID: input["attemptID"] }, query: { location: input["location"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointIntegrationCommandConnect = (raw: RawClient["server.integration"]) => (input: IntegrationCommandConnectInput) => preserveEffect()( raw["integration.command.connect"]({ params: { integrationID: input["integrationID"] }, query: { location: input["location"] }, payload: { methodID: input["methodID"], label: input["label"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointIntegrationCommandStatus = (raw: RawClient["server.integration"]) => (input: IntegrationCommandStatusInput) => preserveEffect()( raw["integration.command.status"]({ params: { integrationID: input["integrationID"], attemptID: input["attemptID"] }, query: { location: input["location"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointIntegrationCommandCancel = (raw: RawClient["server.integration"]) => (input: IntegrationCommandCancelInput) => preserveEffect()( raw["integration.command.cancel"]({ params: { integrationID: input["integrationID"], attemptID: input["attemptID"] }, query: { location: input["location"] }, }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupIntegration = (raw: RawClient["server.integration"]) => ({ list: EndpointIntegrationList(raw), get: EndpointIntegrationGet(raw), wellknown: { add: EndpointIntegrationWellknownAdd(raw) }, connect: { key: EndpointIntegrationConnectKey(raw) }, oauth: { connect: EndpointIntegrationOauthConnect(raw), status: EndpointIntegrationOauthStatus(raw), complete: EndpointIntegrationOauthComplete(raw), cancel: EndpointIntegrationOauthCancel(raw), }, command: { connect: EndpointIntegrationCommandConnect(raw), status: EndpointIntegrationCommandStatus(raw), cancel: EndpointIntegrationCommandCancel(raw), }, }) const EndpointMcpList = (raw: RawClient["server.mcp"]) => (input?: McpListInput) => preserveEffect()( raw["mcp.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointMcpAdd = (raw: RawClient["server.mcp"]) => (input: McpAddInput) => preserveEffect()( raw["mcp.add"]({ params: { server: input["server"] }, query: { location: input["location"] }, payload: { config: input["config"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointMcpRemove = (raw: RawClient["server.mcp"]) => (input: McpRemoveInput) => preserveEffect()( raw["mcp.remove"]({ params: { server: input["server"] }, query: { location: input["location"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointMcpConnect = (raw: RawClient["server.mcp"]) => (input: McpConnectInput) => preserveEffect()( raw["mcp.connect"]({ params: { server: input["server"] }, query: { location: input["location"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointMcpDisconnect = (raw: RawClient["server.mcp"]) => (input: McpDisconnectInput) => preserveEffect()( raw["mcp.disconnect"]({ params: { server: input["server"] }, query: { location: input["location"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointMcpResourceCatalog = (raw: RawClient["server.mcp"]) => (input?: McpResourceCatalogInput) => preserveEffect()( raw["mcp.resource.catalog"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupMcp = (raw: RawClient["server.mcp"]) => ({ list: EndpointMcpList(raw), add: EndpointMcpAdd(raw), remove: EndpointMcpRemove(raw), connect: EndpointMcpConnect(raw), disconnect: EndpointMcpDisconnect(raw), resource: { catalog: EndpointMcpResourceCatalog(raw) }, }) const EndpointCredentialUpdate = (raw: RawClient["server.credential"]) => (input: CredentialUpdateInput) => preserveEffect()( raw["credential.update"]({ params: { credentialID: input["credentialID"] }, payload: { label: input["label"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointCredentialActivate = (raw: RawClient["server.credential"]) => (input: CredentialActivateInput) => preserveEffect()( raw["credential.activate"]({ params: { credentialID: input["credentialID"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointCredentialRemove = (raw: RawClient["server.credential"]) => (input: CredentialRemoveInput) => preserveEffect()( raw["credential.remove"]({ params: { credentialID: input["credentialID"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupCredential = (raw: RawClient["server.credential"]) => ({ update: EndpointCredentialUpdate(raw), activate: EndpointCredentialActivate(raw), remove: EndpointCredentialRemove(raw), }) const EndpointProjectList = (raw: RawClient["server.project"]) => () => preserveEffect()(raw["project.list"]({}).pipe(Effect.mapError(mapClientError))) const EndpointProjectUpdate = (raw: RawClient["server.project"]) => (input: ProjectUpdateInput) => preserveEffect()( raw["project.update"]({ params: { projectID: input["projectID"] }, payload: { canonical: input["canonical"], name: input["name"], icon: input["icon"], commands: input["commands"] }, }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupProject = (raw: RawClient["server.project"]) => ({ list: EndpointProjectList(raw), update: EndpointProjectUpdate(raw), }) const EndpointFormList = (raw: RawClient["server.form"]) => (input?: FormListInput) => preserveEffect()( raw["form.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupForm = (raw: RawClient["server.form"]) => ({ list: EndpointFormList(raw) }) const EndpointPermissionRequestList = (raw: RawClient["server.permission"]) => (input?: PermissionRequestListInput) => preserveEffect()( raw["permission.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointPermissionSavedList = (raw: RawClient["server.permission"]) => (input?: PermissionSavedListInput) => preserveEffect()( raw["permission.saved.list"]({ query: { projectID: input?.["projectID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointPermissionSavedRemove = (raw: RawClient["server.permission"]) => (input: PermissionSavedRemoveInput) => preserveEffect()( raw["permission.saved.remove"]({ params: { id: input["id"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointPermissionCreate = (raw: RawClient["server.permission"]) => (input: PermissionCreateInput) => preserveEffect()( 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), ), ) const EndpointPermissionList = (raw: RawClient["server.permission"]) => (input: PermissionListInput) => preserveEffect()( raw["session.permission.list"]({ params: { sessionID: input["sessionID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointPermissionGet = (raw: RawClient["server.permission"]) => (input: PermissionGetInput) => preserveEffect()( raw["session.permission.get"]({ params: { sessionID: input["sessionID"], requestID: input["requestID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointPermissionReply = (raw: RawClient["server.permission"]) => (input: PermissionReplyInput) => preserveEffect()( raw["session.permission.reply"]({ params: { sessionID: input["sessionID"], requestID: input["requestID"] }, payload: { decision: input["decision"], message: input["message"] }, }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupPermission = (raw: RawClient["server.permission"]) => ({ request: { list: EndpointPermissionRequestList(raw) }, saved: { list: EndpointPermissionSavedList(raw), remove: EndpointPermissionSavedRemove(raw) }, create: EndpointPermissionCreate(raw), list: EndpointPermissionList(raw), get: EndpointPermissionGet(raw), reply: EndpointPermissionReply(raw), }) const EndpointFileList = (raw: RawClient["server.fs"]) => (input?: FileListInput) => preserveEffect()( raw["fs.list"]({ query: { location: input?.["location"], path: input?.["path"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointFileFind = (raw: RawClient["server.fs"]) => (input: FileFindInput) => preserveEffect()( raw["fs.find"]({ query: { location: input["location"], query: input["query"], type: input["type"], limit: input["limit"] }, }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupFile = (raw: RawClient["server.fs"]) => ({ list: EndpointFileList(raw), find: EndpointFileFind(raw) }) const EndpointCommandList = (raw: RawClient["server.command"]) => (input?: CommandListInput) => preserveEffect()( raw["command.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupCommand = (raw: RawClient["server.command"]) => ({ list: EndpointCommandList(raw) }) const EndpointSkillList = (raw: RawClient["server.skill"]) => (input?: SkillListInput) => preserveEffect()( raw["skill.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupSkill = (raw: RawClient["server.skill"]) => ({ list: EndpointSkillList(raw) }) const EndpointRpcCall = (raw: RawClient["server.rpc"]) => (input: RpcCallInput) => preserveEffect()( raw["rpc.call"]({ params: { rpcID: input["rpcID"], method: input["method"] }, query: { location: input["location"] }, payload: { input: input["input"] }, }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupRpc = (raw: RawClient["server.rpc"]) => ({ call: EndpointRpcCall(raw) }) const EndpointEventSubscribe = (raw: RawClient["server.event"]) => () => preserveStream()( Stream.unwrap( raw["event.subscribe"]({}).pipe( Effect.mapError(mapClientError), Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError))), ), ), ) const adaptGroupEvent = (raw: RawClient["server.event"]) => ({ subscribe: EndpointEventSubscribe(raw) }) const EndpointPtyList = (raw: RawClient["server.pty"]) => (input?: PtyListInput) => preserveEffect()( raw["pty.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointPtyCreate = (raw: RawClient["server.pty"]) => (input?: PtyCreateInput) => preserveEffect()( 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)), ) const EndpointPtyGet = (raw: RawClient["server.pty"]) => (input: PtyGetInput) => preserveEffect()( raw["pty.get"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointPtyUpdate = (raw: RawClient["server.pty"]) => (input: PtyUpdateInput) => preserveEffect()( raw["pty.update"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] }, payload: { title: input["title"], size: input["size"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointPtyRemove = (raw: RawClient["server.pty"]) => (input: PtyRemoveInput) => preserveEffect()( raw["pty.remove"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointPtyConnectToken = (raw: RawClient["server.pty"]) => (input: PtyConnectTokenInput) => preserveEffect()( raw["pty.connectToken"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] }, headers: { "x-opencode-ticket": input["x-opencode-ticket"] }, }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupPty = (raw: RawClient["server.pty"]) => ({ list: EndpointPtyList(raw), create: EndpointPtyCreate(raw), get: EndpointPtyGet(raw), update: EndpointPtyUpdate(raw), remove: EndpointPtyRemove(raw), connect: { token: EndpointPtyConnectToken(raw) }, }) const EndpointExperimentalPersistentPtyRead = (raw: RawClient["server.experimental"]) => (input: ExperimentalPersistentPtyReadInput) => preserveEffect()( raw["persistentPty.read"]({ params: { sessionID: input["sessionID"] }, query: { lines: input["lines"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointExperimentalPersistentPtyList = (raw: RawClient["server.experimental"]) => (input: ExperimentalPersistentPtyListInput) => preserveEffect()( raw["persistentPty.list"]({ params: { sessionID: input["sessionID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointExperimentalPersistentPtyCreate = (raw: RawClient["server.experimental"]) => (input: ExperimentalPersistentPtyCreateInput) => preserveEffect()( raw["persistentPty.create"]({ params: { sessionID: input["sessionID"] }, payload: { command: input["command"], args: input["args"], cwd: input["cwd"], title: input["title"], env: input["env"], size: input["size"], }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointExperimentalPersistentPtyShutdown = (raw: RawClient["server.experimental"]) => () => preserveEffect()( raw["persistentPty.shutdown"]({}).pipe(Effect.mapError(mapClientError)), ) const EndpointExperimentalPersistentPtyHandoff = (raw: RawClient["server.experimental"]) => () => preserveEffect()( raw["persistentPty.handoff"]({}).pipe(Effect.mapError(mapClientError)), ) const EndpointExperimentalPersistentPtyGet = (raw: RawClient["server.experimental"]) => (input: ExperimentalPersistentPtyGetInput) => preserveEffect()( raw["persistentPty.get"]({ params: { ptyID: input["ptyID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointExperimentalPersistentPtyUpdate = (raw: RawClient["server.experimental"]) => (input: ExperimentalPersistentPtyUpdateInput) => preserveEffect()( raw["persistentPty.update"]({ params: { ptyID: input["ptyID"] }, payload: { attachmentID: input["attachmentID"], size: input["size"] }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointExperimentalPersistentPtySnapshot = (raw: RawClient["server.experimental"]) => (input: ExperimentalPersistentPtySnapshotInput) => preserveEffect()( raw["persistentPty.snapshot"]({ params: { ptyID: input["ptyID"] } }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const EndpointExperimentalPersistentPtyRemove = (raw: RawClient["server.experimental"]) => (input: ExperimentalPersistentPtyRemoveInput) => preserveEffect()( raw["persistentPty.remove"]({ params: { ptyID: input["ptyID"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointExperimentalPersistentPtyConnectToken = (raw: RawClient["server.experimental"]) => (input: ExperimentalPersistentPtyConnectTokenInput) => preserveEffect()( raw["persistentPty.connectToken"]({ params: { ptyID: input["ptyID"] }, headers: { "x-opencode-ticket": input["x-opencode-ticket"] }, }).pipe( Effect.mapError(mapClientError), Effect.map((value) => value.data), ), ) const adaptGroupExperimental = (raw: RawClient["server.experimental"]) => ({ persistentPty: { read: EndpointExperimentalPersistentPtyRead(raw), list: EndpointExperimentalPersistentPtyList(raw), create: EndpointExperimentalPersistentPtyCreate(raw), shutdown: EndpointExperimentalPersistentPtyShutdown(raw), handoff: EndpointExperimentalPersistentPtyHandoff(raw), get: EndpointExperimentalPersistentPtyGet(raw), update: EndpointExperimentalPersistentPtyUpdate(raw), snapshot: EndpointExperimentalPersistentPtySnapshot(raw), remove: EndpointExperimentalPersistentPtyRemove(raw), connectToken: EndpointExperimentalPersistentPtyConnectToken(raw), }, }) const EndpointShellList = (raw: RawClient["server.shell"]) => (input?: ShellListInput) => preserveEffect()( raw["shell.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointShellCreate = (raw: RawClient["server.shell"]) => (input: ShellCreateInput) => preserveEffect()( raw["shell.create"]({ query: { location: input["location"] }, payload: { command: input["command"], cwd: input["cwd"], timeout: input["timeout"], metadata: input["metadata"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointShellGet = (raw: RawClient["server.shell"]) => (input: ShellGetInput) => preserveEffect()( raw["shell.get"]({ params: { id: input["id"] }, query: { location: input["location"] } }).pipe( Effect.mapError(mapClientError), ), ) const EndpointShellOutput = (raw: RawClient["server.shell"]) => (input: ShellOutputInput) => preserveEffect()( raw["shell.output"]({ params: { id: input["id"] }, query: { location: input["location"], cursor: input["cursor"], limit: input["limit"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointShellRemove = (raw: RawClient["server.shell"]) => (input: ShellRemoveInput) => preserveEffect()( raw["shell.remove"]({ params: { id: input["id"] }, query: { location: input["location"] } }).pipe( Effect.mapError(mapClientError), ), ) const adaptGroupShell = (raw: RawClient["server.shell"]) => ({ list: EndpointShellList(raw), create: EndpointShellCreate(raw), get: EndpointShellGet(raw), output: EndpointShellOutput(raw), remove: EndpointShellRemove(raw), }) const EndpointReferenceList = (raw: RawClient["server.reference"]) => (input?: ReferenceListInput) => preserveEffect()( raw["reference.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupReference = (raw: RawClient["server.reference"]) => ({ list: EndpointReferenceList(raw) }) const EndpointWorktreeList = (raw: RawClient["server.worktree"]) => (input: WorktreeListInput) => preserveEffect()( raw["worktree.list"]({ query: { projectID: input["projectID"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointWorktreeCreate = (raw: RawClient["server.worktree"]) => (input: WorktreeCreateInput) => preserveEffect()( raw["worktree.create"]({ payload: { projectID: input["projectID"], from: input["from"], branch: input["branch"], directory: input["directory"], name: input["name"], }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointWorktreeRemove = (raw: RawClient["server.worktree"]) => (input: WorktreeRemoveInput) => preserveEffect()( raw["worktree.remove"]({ payload: { projectID: input["projectID"], directory: input["directory"], force: input["force"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointWorktreeRefresh = (raw: RawClient["server.worktree"]) => (input: WorktreeRefreshInput) => preserveEffect()( raw["worktree.refresh"]({ payload: { projectID: input["projectID"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupWorktree = (raw: RawClient["server.worktree"]) => ({ list: EndpointWorktreeList(raw), create: EndpointWorktreeCreate(raw), remove: EndpointWorktreeRemove(raw), refresh: EndpointWorktreeRefresh(raw), }) const EndpointVcsGet = (raw: RawClient["server.vcs"]) => (input?: VcsGetInput) => preserveEffect()( raw["vcs.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointVcsBase = (raw: RawClient["server.vcs"]) => (input?: VcsBaseInput) => preserveEffect()( raw["vcs.base"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointVcsStatus = (raw: RawClient["server.vcs"]) => (input?: VcsStatusInput) => preserveEffect()( raw["vcs.status"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointVcsBranchList = (raw: RawClient["server.vcs"]) => (input?: VcsBranchListInput) => preserveEffect()( raw["vcs.branch.list"]({ query: { location: input?.["location"], search: input?.["search"], limit: input?.["limit"] }, }).pipe(Effect.mapError(mapClientError)), ) const EndpointVcsDiff = (raw: RawClient["server.vcs"]) => (input: VcsDiffInput) => preserveEffect()( raw["vcs.diff"]({ query: { location: input["location"], mode: input["mode"], base: input["base"], context: input["context"] }, }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupVcs = (raw: RawClient["server.vcs"]) => ({ get: EndpointVcsGet(raw), base: EndpointVcsBase(raw), status: EndpointVcsStatus(raw), branch: { list: EndpointVcsBranchList(raw) }, diff: EndpointVcsDiff(raw), }) const EndpointDebugLocationList = (raw: RawClient["server.debug"]) => () => preserveEffect()(raw["debug.location"]({}).pipe(Effect.mapError(mapClientError))) const EndpointDebugLocationEvict = (raw: RawClient["server.debug"]) => (input?: DebugLocationEvictInput) => preserveEffect()( raw["debug.location.evict"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupDebug = (raw: RawClient["server.debug"]) => ({ location: { list: EndpointDebugLocationList(raw), evict: EndpointDebugLocationEvict(raw) }, }) const EndpointMigrationV1Status = (raw: RawClient["server.migration"]) => () => preserveEffect()(raw["migration.v1.status"]({}).pipe(Effect.mapError(mapClientError))) const adaptGroupMigration = (raw: RawClient["server.migration"]) => ({ v1: { status: EndpointMigrationV1Status(raw) } }) const EndpointWebsearchProviders = (raw: RawClient["server.websearch"]) => (input?: WebsearchProvidersInput) => preserveEffect()( raw["websearch.providers"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointWebsearchQuery = (raw: RawClient["server.websearch"]) => (input: WebsearchQueryInput) => preserveEffect()( raw["websearch.query"]({ query: { location: input["location"] }, payload: { query: input["query"], providerID: input["providerID"] }, }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupWebsearch = (raw: RawClient["server.websearch"]) => ({ providers: EndpointWebsearchProviders(raw), query: EndpointWebsearchQuery(raw), }) const EndpointConfigGet = (raw: RawClient["server.config"]) => (input?: ConfigGetInput) => preserveEffect()( raw["config.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)), ) const EndpointConfigShells = (raw: RawClient["server.config"]) => () => preserveEffect()(raw["config.shells"]({}).pipe(Effect.mapError(mapClientError))) const EndpointConfigUpdate = (raw: RawClient["server.config"]) => (input: ConfigUpdateInput) => preserveEffect()( raw["config.update"]({ payload: { shell: input["shell"] } }).pipe(Effect.mapError(mapClientError)), ) const adaptGroupConfig = (raw: RawClient["server.config"]) => ({ get: EndpointConfigGet(raw), shells: EndpointConfigShells(raw), update: EndpointConfigUpdate(raw), }) const adaptClient = (raw: RawClient) => ({ server: adaptGroupServer(raw["server.server"]), location: adaptGroupLocation(raw["server.location"]), agent: adaptGroupAgent(raw["server.agent"]), plugin: adaptGroupPlugin(raw["server.plugin"]), session: adaptGroupSession(raw["server.session"]), message: adaptGroupMessage(raw["server.message"]), model: adaptGroupModel(raw["server.model"]), generate: adaptGroupGenerate(raw["server.generate"]), provider: adaptGroupProvider(raw["server.provider"]), integration: adaptGroupIntegration(raw["server.integration"]), mcp: adaptGroupMcp(raw["server.mcp"]), credential: adaptGroupCredential(raw["server.credential"]), project: adaptGroupProject(raw["server.project"]), form: adaptGroupForm(raw["server.form"]), permission: adaptGroupPermission(raw["server.permission"]), file: adaptGroupFile(raw["server.fs"]), command: adaptGroupCommand(raw["server.command"]), skill: adaptGroupSkill(raw["server.skill"]), rpc: adaptGroupRpc(raw["server.rpc"]), event: adaptGroupEvent(raw["server.event"]), pty: adaptGroupPty(raw["server.pty"]), experimental: adaptGroupExperimental(raw["server.experimental"]), shell: adaptGroupShell(raw["server.shell"]), reference: adaptGroupReference(raw["server.reference"]), worktree: adaptGroupWorktree(raw["server.worktree"]), vcs: adaptGroupVcs(raw["server.vcs"]), debug: adaptGroupDebug(raw["server.debug"]), migration: adaptGroupMigration(raw["server.migration"]), websearch: adaptGroupWebsearch(raw["server.websearch"]), config: adaptGroupConfig(raw["server.config"]), }) export const make = (options?: { readonly baseUrl?: URL | string }) => HttpApiClient.make(ClientApi, options).pipe(Effect.map(adaptClient))