mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-26 11:51:56 +00:00
1379 lines
51 KiB
TypeScript
1379 lines
51 KiB
TypeScript
// 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 type {
|
|
HealthGetOutput,
|
|
ServerGetOutput,
|
|
LocationGetInput,
|
|
LocationGetOutput,
|
|
AgentListInput,
|
|
AgentListOutput,
|
|
AgentGetInput,
|
|
AgentGetOutput,
|
|
PluginListInput,
|
|
PluginListOutput,
|
|
SessionListInput,
|
|
SessionListOutput,
|
|
SessionStatsInput,
|
|
SessionStatsOutput,
|
|
SessionCreateInput,
|
|
SessionCreateOutput,
|
|
SessionImportInput,
|
|
SessionImportOutput,
|
|
SessionExportInput,
|
|
SessionExportOutput,
|
|
SessionActiveOutput,
|
|
SessionGetInput,
|
|
SessionGetOutput,
|
|
SessionRemoveInput,
|
|
SessionRemoveOutput,
|
|
SessionForkInput,
|
|
SessionForkOutput,
|
|
SessionSwitchAgentInput,
|
|
SessionSwitchAgentOutput,
|
|
SessionSwitchModelInput,
|
|
SessionSwitchModelOutput,
|
|
SessionRenameInput,
|
|
SessionRenameOutput,
|
|
SessionMoveInput,
|
|
SessionMoveOutput,
|
|
SessionPromptInput,
|
|
SessionPromptOutput,
|
|
SessionCommandInput,
|
|
SessionCommandOutput,
|
|
SessionSkillInput,
|
|
SessionSkillOutput,
|
|
SessionSyntheticInput,
|
|
SessionSyntheticOutput,
|
|
SessionShellInput,
|
|
SessionShellOutput,
|
|
SessionCompactInput,
|
|
SessionCompactOutput,
|
|
SessionWaitInput,
|
|
SessionWaitOutput,
|
|
SessionRevertStageInput,
|
|
SessionRevertStageOutput,
|
|
SessionRevertClearInput,
|
|
SessionRevertClearOutput,
|
|
SessionRevertCommitInput,
|
|
SessionRevertCommitOutput,
|
|
SessionContextInput,
|
|
SessionContextOutput,
|
|
SessionInboxListInput,
|
|
SessionInboxListOutput,
|
|
SessionInboxCancelInput,
|
|
SessionInboxCancelOutput,
|
|
SessionInboxSteerInput,
|
|
SessionInboxSteerOutput,
|
|
SessionInboxQueueInput,
|
|
SessionInboxQueueOutput,
|
|
SessionInstructionsEntryListInput,
|
|
SessionInstructionsEntryListOutput,
|
|
SessionInstructionsEntryPutInput,
|
|
SessionInstructionsEntryPutOutput,
|
|
SessionInstructionsEntryRemoveInput,
|
|
SessionInstructionsEntryRemoveOutput,
|
|
SessionGenerateInput,
|
|
SessionGenerateOutput,
|
|
SessionLogInput,
|
|
SessionLogOutput,
|
|
SessionInterruptInput,
|
|
SessionInterruptOutput,
|
|
SessionBackgroundInput,
|
|
SessionBackgroundOutput,
|
|
SessionMessageInput,
|
|
SessionMessageOutput,
|
|
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,
|
|
CredentialRemoveInput,
|
|
CredentialRemoveOutput,
|
|
ProjectListOutput,
|
|
ProjectCurrentInput,
|
|
ProjectCurrentOutput,
|
|
FormRequestListInput,
|
|
FormRequestListOutput,
|
|
FormListInput,
|
|
FormListOutput,
|
|
FormCreateInput,
|
|
FormCreateOutput,
|
|
FormGetInput,
|
|
FormGetOutput,
|
|
FormStateInput,
|
|
FormStateOutput,
|
|
FormReplyInput,
|
|
FormReplyOutput,
|
|
FormCancelInput,
|
|
FormCancelOutput,
|
|
PermissionRequestListInput,
|
|
PermissionRequestListOutput,
|
|
PermissionSavedListInput,
|
|
PermissionSavedListOutput,
|
|
PermissionSavedRemoveInput,
|
|
PermissionSavedRemoveOutput,
|
|
PermissionCreateInput,
|
|
PermissionCreateOutput,
|
|
PermissionListInput,
|
|
PermissionListOutput,
|
|
PermissionGetInput,
|
|
PermissionGetOutput,
|
|
PermissionReplyInput,
|
|
PermissionReplyOutput,
|
|
FileListInput,
|
|
FileListOutput,
|
|
FileFindInput,
|
|
FileFindOutput,
|
|
CommandListInput,
|
|
CommandListOutput,
|
|
SkillListInput,
|
|
SkillListOutput,
|
|
EventSubscribeOutput,
|
|
PtyListInput,
|
|
PtyListOutput,
|
|
PtyCreateInput,
|
|
PtyCreateOutput,
|
|
PtyGetInput,
|
|
PtyGetOutput,
|
|
PtyUpdateInput,
|
|
PtyUpdateOutput,
|
|
PtyRemoveInput,
|
|
PtyRemoveOutput,
|
|
PtyConnectTokenInput,
|
|
PtyConnectTokenOutput,
|
|
ShellListInput,
|
|
ShellListOutput,
|
|
ShellCreateInput,
|
|
ShellCreateOutput,
|
|
ShellGetInput,
|
|
ShellGetOutput,
|
|
ShellTimeoutInput,
|
|
ShellTimeoutOutput,
|
|
ShellOutputInput,
|
|
ShellOutputOutput,
|
|
ShellRemoveInput,
|
|
ShellRemoveOutput,
|
|
ReferenceListInput,
|
|
ReferenceListOutput,
|
|
WorktreeListInput,
|
|
WorktreeListOutput,
|
|
WorktreeCreateInput,
|
|
WorktreeCreateOutput,
|
|
WorktreeRemoveInput,
|
|
WorktreeRemoveOutput,
|
|
WorktreeRefreshInput,
|
|
WorktreeRefreshOutput,
|
|
VcsGetInput,
|
|
VcsGetOutput,
|
|
VcsStatusInput,
|
|
VcsStatusOutput,
|
|
VcsDiffInput,
|
|
VcsDiffOutput,
|
|
DebugLocationListOutput,
|
|
DebugLocationEvictInput,
|
|
DebugLocationEvictOutput,
|
|
MigrationV1StatusOutput,
|
|
WebsearchProvidersInput,
|
|
WebsearchProvidersOutput,
|
|
WebsearchQueryInput,
|
|
WebsearchQueryOutput,
|
|
ConfigGetInput,
|
|
ConfigGetOutput,
|
|
} from "../api/api.js"
|
|
import { ClientError } from "./client-error.js"
|
|
|
|
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 preserveEffect =
|
|
<A>() =>
|
|
<E, R>(effect: Effect.Effect<A, E, R>) =>
|
|
effect
|
|
const preserveStream =
|
|
<A>() =>
|
|
<E, R>(stream: Stream.Stream<A, E, R>) =>
|
|
stream
|
|
|
|
const EndpointHealthGet = (raw: RawClient["server.health"]) => () =>
|
|
preserveEffect<HealthGetOutput>()(raw["health.get"]({}).pipe(Effect.mapError(mapClientError)))
|
|
|
|
const adaptGroupHealth = (raw: RawClient["server.health"]) => ({ get: EndpointHealthGet(raw) })
|
|
|
|
const EndpointServerGet = (raw: RawClient["server.server"]) => () =>
|
|
preserveEffect<ServerGetOutput>()(raw["server.get"]({}).pipe(Effect.mapError(mapClientError)))
|
|
|
|
const adaptGroupServer = (raw: RawClient["server.server"]) => ({ get: EndpointServerGet(raw) })
|
|
|
|
const EndpointLocationGet = (raw: RawClient["server.location"]) => (input?: LocationGetInput) =>
|
|
preserveEffect<LocationGetOutput>()(
|
|
raw["location.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const adaptGroupLocation = (raw: RawClient["server.location"]) => ({ get: EndpointLocationGet(raw) })
|
|
|
|
const EndpointAgentList = (raw: RawClient["server.agent"]) => (input?: AgentListInput) =>
|
|
preserveEffect<AgentListOutput>()(
|
|
raw["agent.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointAgentGet = (raw: RawClient["server.agent"]) => (input: AgentGetInput) =>
|
|
preserveEffect<AgentGetOutput>()(
|
|
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<PluginListOutput>()(
|
|
raw["plugin.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const adaptGroupPlugin = (raw: RawClient["server.plugin"]) => ({ list: EndpointPluginList(raw) })
|
|
|
|
const EndpointSessionList = (raw: RawClient["server.session"]) => (input?: SessionListInput) =>
|
|
preserveEffect<SessionListOutput>()(
|
|
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)),
|
|
)
|
|
|
|
const EndpointSessionStats = (raw: RawClient["server.session"]) => (input?: SessionStatsInput) =>
|
|
preserveEffect<SessionStatsOutput>()(
|
|
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<SessionCreateOutput>()(
|
|
raw["session.create"]({
|
|
payload: {
|
|
id: input?.["id"],
|
|
title: input?.["title"],
|
|
agent: input?.["agent"],
|
|
model: input?.["model"],
|
|
location: input?.["location"],
|
|
},
|
|
}).pipe(
|
|
Effect.mapError(mapClientError),
|
|
Effect.map((value) => value.data),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionImport = (raw: RawClient["server.session"]) => (input: SessionImportInput) =>
|
|
preserveEffect<SessionImportOutput>()(
|
|
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<SessionExportOutput>()(
|
|
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<SessionActiveOutput>()(
|
|
raw["session.active"]({}).pipe(
|
|
Effect.mapError(mapClientError),
|
|
Effect.map((value) => value.data),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionGet = (raw: RawClient["server.session"]) => (input: SessionGetInput) =>
|
|
preserveEffect<SessionGetOutput>()(
|
|
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<SessionRemoveOutput>()(
|
|
raw["session.remove"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointSessionFork = (raw: RawClient["server.session"]) => (input: SessionForkInput) =>
|
|
preserveEffect<SessionForkOutput>()(
|
|
raw["session.fork"]({ params: { sessionID: input["sessionID"] }, payload: { boundary: input["boundary"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
Effect.map((value) => value.data),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionSwitchAgent = (raw: RawClient["server.session"]) => (input: SessionSwitchAgentInput) =>
|
|
preserveEffect<SessionSwitchAgentOutput>()(
|
|
raw["session.switchAgent"]({ params: { sessionID: input["sessionID"] }, payload: { agent: input["agent"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionSwitchModel = (raw: RawClient["server.session"]) => (input: SessionSwitchModelInput) =>
|
|
preserveEffect<SessionSwitchModelOutput>()(
|
|
raw["session.switchModel"]({ params: { sessionID: input["sessionID"] }, payload: { model: input["model"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionRename = (raw: RawClient["server.session"]) => (input: SessionRenameInput) =>
|
|
preserveEffect<SessionRenameOutput>()(
|
|
raw["session.rename"]({ params: { sessionID: input["sessionID"] }, payload: { title: input["title"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionMove = (raw: RawClient["server.session"]) => (input: SessionMoveInput) =>
|
|
preserveEffect<SessionMoveOutput>()(
|
|
raw["session.move"]({
|
|
params: { sessionID: input["sessionID"] },
|
|
payload: { directory: input["directory"], workspaceID: input["workspaceID"], delivery: input["delivery"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointSessionPrompt = (raw: RawClient["server.session"]) => (input: SessionPromptInput) =>
|
|
preserveEffect<SessionPromptOutput>()(
|
|
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<SessionCommandOutput>()(
|
|
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"],
|
|
skills: input["skills"],
|
|
delivery: input["delivery"],
|
|
resume: input["resume"],
|
|
},
|
|
}).pipe(
|
|
Effect.mapError(mapClientError),
|
|
Effect.map((value) => value.data),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionSkill = (raw: RawClient["server.session"]) => (input: SessionSkillInput) =>
|
|
preserveEffect<SessionSkillOutput>()(
|
|
raw["session.skill"]({
|
|
params: { sessionID: input["sessionID"] },
|
|
payload: { id: input["id"], skill: input["skill"], resume: input["resume"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointSessionSynthetic = (raw: RawClient["server.session"]) => (input: SessionSyntheticInput) =>
|
|
preserveEffect<SessionSyntheticOutput>()(
|
|
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<SessionShellOutput>()(
|
|
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<SessionCompactOutput>()(
|
|
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<SessionWaitOutput>()(
|
|
raw["session.wait"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointSessionRevertStage = (raw: RawClient["server.session"]) => (input: SessionRevertStageInput) =>
|
|
preserveEffect<SessionRevertStageOutput>()(
|
|
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<SessionRevertClearOutput>()(
|
|
raw["session.revert.clear"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointSessionRevertCommit = (raw: RawClient["server.session"]) => (input: SessionRevertCommitInput) =>
|
|
preserveEffect<SessionRevertCommitOutput>()(
|
|
raw["session.revert.commit"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointSessionContext = (raw: RawClient["server.session"]) => (input: SessionContextInput) =>
|
|
preserveEffect<SessionContextOutput>()(
|
|
raw["session.context"]({ params: { sessionID: input["sessionID"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
Effect.map((value) => value.data),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionInboxList = (raw: RawClient["server.session"]) => (input: SessionInboxListInput) =>
|
|
preserveEffect<SessionInboxListOutput>()(
|
|
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<SessionInboxCancelOutput>()(
|
|
raw["session.inbox.cancel"]({ params: { sessionID: input["sessionID"], inboxID: input["inboxID"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionInboxSteer = (raw: RawClient["server.session"]) => (input: SessionInboxSteerInput) =>
|
|
preserveEffect<SessionInboxSteerOutput>()(
|
|
raw["session.inbox.steer"]({ params: { sessionID: input["sessionID"], inboxID: input["inboxID"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionInboxQueue = (raw: RawClient["server.session"]) => (input: SessionInboxQueueInput) =>
|
|
preserveEffect<SessionInboxQueueOutput>()(
|
|
raw["session.inbox.queue"]({ params: { sessionID: input["sessionID"], inboxID: input["inboxID"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionInstructionsEntryList =
|
|
(raw: RawClient["server.session"]) => (input: SessionInstructionsEntryListInput) =>
|
|
preserveEffect<SessionInstructionsEntryListOutput>()(
|
|
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<SessionInstructionsEntryPutOutput>()(
|
|
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<SessionInstructionsEntryRemoveOutput>()(
|
|
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<SessionGenerateOutput>()(
|
|
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<SessionLogOutput>()(
|
|
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<SessionInterruptOutput>()(
|
|
raw["session.interrupt"]({
|
|
params: { sessionID: input["sessionID"] },
|
|
query: { continue: input["continue"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointSessionBackground = (raw: RawClient["server.session"]) => (input: SessionBackgroundInput) =>
|
|
preserveEffect<SessionBackgroundOutput>()(
|
|
raw["session.background"]({ params: { sessionID: input["sessionID"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointSessionMessage = (raw: RawClient["server.session"]) => (input: SessionMessageInput) =>
|
|
preserveEffect<SessionMessageOutput>()(
|
|
raw["session.message"]({ params: { sessionID: input["sessionID"], messageID: input["messageID"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
Effect.map((value) => value.data),
|
|
),
|
|
)
|
|
|
|
const EndpointSessionEnvironment = (raw: RawClient["server.session"]) => (input: SessionEnvironmentInput) =>
|
|
preserveEffect<SessionEnvironmentOutput>()(
|
|
raw["session.environment"]({
|
|
params: { sessionID: input["sessionID"] },
|
|
payload: { variables: input["variables"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointSessionView = (raw: RawClient["server.session"]) => (input: SessionViewInput) =>
|
|
preserveEffect<SessionViewOutput>()(
|
|
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),
|
|
rename: EndpointSessionRename(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),
|
|
inbox: {
|
|
list: EndpointSessionInboxList(raw),
|
|
cancel: EndpointSessionInboxCancel(raw),
|
|
steer: EndpointSessionInboxSteer(raw),
|
|
queue: EndpointSessionInboxQueue(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: EndpointSessionMessage(raw),
|
|
environment: EndpointSessionEnvironment(raw),
|
|
view: EndpointSessionView(raw),
|
|
})
|
|
|
|
const EndpointMessageList = (raw: RawClient["server.message"]) => (input: MessageListInput) =>
|
|
preserveEffect<MessageListOutput>()(
|
|
raw["session.messages"]({
|
|
params: { sessionID: input["sessionID"] },
|
|
query: { limit: input["limit"], order: input["order"], cursor: input["cursor"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const adaptGroupMessage = (raw: RawClient["server.message"]) => ({ list: EndpointMessageList(raw) })
|
|
|
|
const EndpointModelList = (raw: RawClient["server.model"]) => (input?: ModelListInput) =>
|
|
preserveEffect<ModelListOutput>()(
|
|
raw["model.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointModelDefault = (raw: RawClient["server.model"]) => (input?: ModelDefaultInput) =>
|
|
preserveEffect<ModelDefaultOutput>()(
|
|
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<GenerateTextOutput>()(
|
|
raw["generate.text"]({
|
|
query: { location: input["location"] },
|
|
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<ProviderListOutput>()(
|
|
raw["provider.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointProviderGet = (raw: RawClient["server.provider"]) => (input: ProviderGetInput) =>
|
|
preserveEffect<ProviderGetOutput>()(
|
|
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<IntegrationListOutput>()(
|
|
raw["integration.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointIntegrationGet = (raw: RawClient["server.integration"]) => (input: IntegrationGetInput) =>
|
|
preserveEffect<IntegrationGetOutput>()(
|
|
raw["integration.get"]({
|
|
params: { integrationID: input["integrationID"] },
|
|
query: { location: input["location"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointIntegrationWellknownAdd =
|
|
(raw: RawClient["server.integration"]) => (input: IntegrationWellknownAddInput) =>
|
|
preserveEffect<IntegrationWellknownAddOutput>()(
|
|
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<IntegrationConnectKeyOutput>()(
|
|
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<IntegrationOauthConnectOutput>()(
|
|
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<IntegrationOauthStatusOutput>()(
|
|
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<IntegrationOauthCompleteOutput>()(
|
|
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<IntegrationOauthCancelOutput>()(
|
|
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<IntegrationCommandConnectOutput>()(
|
|
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<IntegrationCommandStatusOutput>()(
|
|
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<IntegrationCommandCancelOutput>()(
|
|
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<McpListOutput>()(
|
|
raw["mcp.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointMcpAdd = (raw: RawClient["server.mcp"]) => (input: McpAddInput) =>
|
|
preserveEffect<McpAddOutput>()(
|
|
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<McpRemoveOutput>()(
|
|
raw["mcp.remove"]({ params: { server: input["server"] }, query: { location: input["location"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointMcpConnect = (raw: RawClient["server.mcp"]) => (input: McpConnectInput) =>
|
|
preserveEffect<McpConnectOutput>()(
|
|
raw["mcp.connect"]({ params: { server: input["server"] }, query: { location: input["location"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointMcpDisconnect = (raw: RawClient["server.mcp"]) => (input: McpDisconnectInput) =>
|
|
preserveEffect<McpDisconnectOutput>()(
|
|
raw["mcp.disconnect"]({ params: { server: input["server"] }, query: { location: input["location"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointMcpResourceCatalog = (raw: RawClient["server.mcp"]) => (input?: McpResourceCatalogInput) =>
|
|
preserveEffect<McpResourceCatalogOutput>()(
|
|
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<CredentialUpdateOutput>()(
|
|
raw["credential.update"]({
|
|
params: { credentialID: input["credentialID"] },
|
|
query: { location: input["location"] },
|
|
payload: { label: input["label"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointCredentialRemove = (raw: RawClient["server.credential"]) => (input: CredentialRemoveInput) =>
|
|
preserveEffect<CredentialRemoveOutput>()(
|
|
raw["credential.remove"]({
|
|
params: { credentialID: input["credentialID"] },
|
|
query: { location: input["location"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const adaptGroupCredential = (raw: RawClient["server.credential"]) => ({
|
|
update: EndpointCredentialUpdate(raw),
|
|
remove: EndpointCredentialRemove(raw),
|
|
})
|
|
|
|
const EndpointProjectList = (raw: RawClient["server.project"]) => () =>
|
|
preserveEffect<ProjectListOutput>()(raw["project.list"]({}).pipe(Effect.mapError(mapClientError)))
|
|
|
|
const EndpointProjectCurrent = (raw: RawClient["server.project"]) => (input?: ProjectCurrentInput) =>
|
|
preserveEffect<ProjectCurrentOutput>()(
|
|
raw["project.current"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const adaptGroupProject = (raw: RawClient["server.project"]) => ({
|
|
list: EndpointProjectList(raw),
|
|
current: EndpointProjectCurrent(raw),
|
|
})
|
|
|
|
const EndpointFormRequestList = (raw: RawClient["server.form"]) => (input?: FormRequestListInput) =>
|
|
preserveEffect<FormRequestListOutput>()(
|
|
raw["form.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointFormList = (raw: RawClient["server.form"]) => (input: FormListInput) =>
|
|
preserveEffect<FormListOutput>()(
|
|
raw["session.form.list"]({ params: { sessionID: input["sessionID"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
Effect.map((value) => value.data),
|
|
),
|
|
)
|
|
|
|
const EndpointFormCreate = (raw: RawClient["server.form"]) => (input: FormCreateInput) =>
|
|
preserveEffect<FormCreateOutput>()(
|
|
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 EndpointFormGet = (raw: RawClient["server.form"]) => (input: FormGetInput) =>
|
|
preserveEffect<FormGetOutput>()(
|
|
raw["session.form.get"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
Effect.map((value) => value.data),
|
|
),
|
|
)
|
|
|
|
const EndpointFormState = (raw: RawClient["server.form"]) => (input: FormStateInput) =>
|
|
preserveEffect<FormStateOutput>()(
|
|
raw["session.form.state"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
Effect.map((value) => value.data),
|
|
),
|
|
)
|
|
|
|
const EndpointFormReply = (raw: RawClient["server.form"]) => (input: FormReplyInput) =>
|
|
preserveEffect<FormReplyOutput>()(
|
|
raw["session.form.reply"]({
|
|
params: { sessionID: input["sessionID"], formID: input["formID"] },
|
|
payload: { answer: input["answer"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointFormCancel = (raw: RawClient["server.form"]) => (input: FormCancelInput) =>
|
|
preserveEffect<FormCancelOutput>()(
|
|
raw["session.form.cancel"]({ params: { sessionID: input["sessionID"], formID: input["formID"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const adaptGroupForm = (raw: RawClient["server.form"]) => ({
|
|
request: { list: EndpointFormRequestList(raw) },
|
|
list: EndpointFormList(raw),
|
|
create: EndpointFormCreate(raw),
|
|
get: EndpointFormGet(raw),
|
|
state: EndpointFormState(raw),
|
|
reply: EndpointFormReply(raw),
|
|
cancel: EndpointFormCancel(raw),
|
|
})
|
|
|
|
const EndpointPermissionRequestList = (raw: RawClient["server.permission"]) => (input?: PermissionRequestListInput) =>
|
|
preserveEffect<PermissionRequestListOutput>()(
|
|
raw["permission.request.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointPermissionSavedList = (raw: RawClient["server.permission"]) => (input?: PermissionSavedListInput) =>
|
|
preserveEffect<PermissionSavedListOutput>()(
|
|
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<PermissionSavedRemoveOutput>()(
|
|
raw["permission.saved.remove"]({ params: { id: input["id"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointPermissionCreate = (raw: RawClient["server.permission"]) => (input: PermissionCreateInput) =>
|
|
preserveEffect<PermissionCreateOutput>()(
|
|
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<PermissionListOutput>()(
|
|
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<PermissionGetOutput>()(
|
|
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<PermissionReplyOutput>()(
|
|
raw["session.permission.reply"]({
|
|
params: { sessionID: input["sessionID"], requestID: input["requestID"] },
|
|
payload: { reply: input["reply"], 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<FileListOutput>()(
|
|
raw["fs.list"]({ query: { location: input?.["location"], path: input?.["path"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointFileFind = (raw: RawClient["server.fs"]) => (input: FileFindInput) =>
|
|
preserveEffect<FileFindOutput>()(
|
|
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<CommandListOutput>()(
|
|
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<SkillListOutput>()(
|
|
raw["skill.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const adaptGroupSkill = (raw: RawClient["server.skill"]) => ({ list: EndpointSkillList(raw) })
|
|
|
|
const EndpointEventSubscribe = (raw: RawClient["server.event"]) => () =>
|
|
preserveStream<EventSubscribeOutput>()(
|
|
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<PtyListOutput>()(
|
|
raw["pty.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointPtyCreate = (raw: RawClient["server.pty"]) => (input?: PtyCreateInput) =>
|
|
preserveEffect<PtyCreateOutput>()(
|
|
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<PtyGetOutput>()(
|
|
raw["pty.get"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointPtyUpdate = (raw: RawClient["server.pty"]) => (input: PtyUpdateInput) =>
|
|
preserveEffect<PtyUpdateOutput>()(
|
|
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<PtyRemoveOutput>()(
|
|
raw["pty.remove"]({ params: { ptyID: input["ptyID"] }, query: { location: input["location"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointPtyConnectToken = (raw: RawClient["server.pty"]) => (input: PtyConnectTokenInput) =>
|
|
preserveEffect<PtyConnectTokenOutput>()(
|
|
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 EndpointShellList = (raw: RawClient["server.shell"]) => (input?: ShellListInput) =>
|
|
preserveEffect<ShellListOutput>()(
|
|
raw["shell.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointShellCreate = (raw: RawClient["server.shell"]) => (input: ShellCreateInput) =>
|
|
preserveEffect<ShellCreateOutput>()(
|
|
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<ShellGetOutput>()(
|
|
raw["shell.get"]({ params: { id: input["id"] }, query: { location: input["location"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const EndpointShellTimeout = (raw: RawClient["server.shell"]) => (input: ShellTimeoutInput) =>
|
|
preserveEffect<ShellTimeoutOutput>()(
|
|
raw["shell.timeout"]({
|
|
params: { id: input["id"] },
|
|
query: { location: input["location"] },
|
|
payload: { timeout: input["timeout"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointShellOutput = (raw: RawClient["server.shell"]) => (input: ShellOutputInput) =>
|
|
preserveEffect<ShellOutputOutput>()(
|
|
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<ShellRemoveOutput>()(
|
|
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),
|
|
timeout: EndpointShellTimeout(raw),
|
|
output: EndpointShellOutput(raw),
|
|
remove: EndpointShellRemove(raw),
|
|
})
|
|
|
|
const EndpointReferenceList = (raw: RawClient["server.reference"]) => (input?: ReferenceListInput) =>
|
|
preserveEffect<ReferenceListOutput>()(
|
|
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<WorktreeListOutput>()(
|
|
raw["worktree.list"]({ params: { projectID: input["projectID"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointWorktreeCreate = (raw: RawClient["server.worktree"]) => (input: WorktreeCreateInput) =>
|
|
preserveEffect<WorktreeCreateOutput>()(
|
|
raw["worktree.create"]({
|
|
params: { projectID: input["projectID"] },
|
|
payload: { strategy: input["strategy"], from: input["from"], directory: input["directory"], name: input["name"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointWorktreeRemove = (raw: RawClient["server.worktree"]) => (input: WorktreeRemoveInput) =>
|
|
preserveEffect<WorktreeRemoveOutput>()(
|
|
raw["worktree.remove"]({
|
|
params: { projectID: input["projectID"] },
|
|
payload: { directory: input["directory"], force: input["force"] },
|
|
}).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointWorktreeRefresh = (raw: RawClient["server.worktree"]) => (input: WorktreeRefreshInput) =>
|
|
preserveEffect<WorktreeRefreshOutput>()(
|
|
raw["worktree.refresh"]({ params: { 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<VcsGetOutput>()(
|
|
raw["vcs.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointVcsStatus = (raw: RawClient["server.vcs"]) => (input?: VcsStatusInput) =>
|
|
preserveEffect<VcsStatusOutput>()(
|
|
raw["vcs.status"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointVcsDiff = (raw: RawClient["server.vcs"]) => (input: VcsDiffInput) =>
|
|
preserveEffect<VcsDiffOutput>()(
|
|
raw["vcs.diff"]({ query: { location: input["location"], mode: input["mode"], context: input["context"] } }).pipe(
|
|
Effect.mapError(mapClientError),
|
|
),
|
|
)
|
|
|
|
const adaptGroupVcs = (raw: RawClient["server.vcs"]) => ({
|
|
get: EndpointVcsGet(raw),
|
|
status: EndpointVcsStatus(raw),
|
|
diff: EndpointVcsDiff(raw),
|
|
})
|
|
|
|
const EndpointDebugLocationList = (raw: RawClient["server.debug"]) => () =>
|
|
preserveEffect<DebugLocationListOutput>()(raw["debug.location"]({}).pipe(Effect.mapError(mapClientError)))
|
|
|
|
const EndpointDebugLocationEvict = (raw: RawClient["server.debug"]) => (input?: DebugLocationEvictInput) =>
|
|
preserveEffect<DebugLocationEvictOutput>()(
|
|
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<MigrationV1StatusOutput>()(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<WebsearchProvidersOutput>()(
|
|
raw["websearch.providers"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const EndpointWebsearchQuery = (raw: RawClient["server.websearch"]) => (input: WebsearchQueryInput) =>
|
|
preserveEffect<WebsearchQueryOutput>()(
|
|
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<ConfigGetOutput>()(
|
|
raw["config.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)),
|
|
)
|
|
|
|
const adaptGroupConfig = (raw: RawClient["server.config"]) => ({ get: EndpointConfigGet(raw) })
|
|
|
|
const adaptClient = (raw: RawClient) => ({
|
|
health: adaptGroupHealth(raw["server.health"]),
|
|
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"]),
|
|
event: adaptGroupEvent(raw["server.event"]),
|
|
pty: adaptGroupPty(raw["server.pty"]),
|
|
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))
|