From dfc0075f90e5dae6f17beb5c337a0b09c3216908 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" Date: Mon, 27 Apr 2026 20:52:42 +0000 Subject: [PATCH] chore: generate --- .../server/routes/instance/httpapi/control.ts | 77 ++++++----- .../server/routes/instance/httpapi/event.ts | 31 +++-- .../server/routes/instance/httpapi/global.ts | 125 +++++++++--------- .../src/server/routes/instance/httpapi/pty.ts | 36 ++--- .../test/server/httpapi-bridge.test.ts | 4 +- 5 files changed, 136 insertions(+), 137 deletions(-) diff --git a/packages/opencode/src/server/routes/instance/httpapi/control.ts b/packages/opencode/src/server/routes/instance/httpapi/control.ts index 14cbdf7c45..f850f76e7e 100644 --- a/packages/opencode/src/server/routes/instance/httpapi/control.ts +++ b/packages/opencode/src/server/routes/instance/httpapi/control.ts @@ -31,42 +31,41 @@ export const ControlPaths = { log: "/log", } as const -export const ControlApi = HttpApi.make("control") - .add( - HttpApiGroup.make("control") - .add( - HttpApiEndpoint.put("authSet", ControlPaths.auth, { - params: AuthParams, - payload: Auth.Info, - success: Schema.Boolean, - }).annotateMerge( - OpenApi.annotations({ - identifier: "auth.set", - summary: "Set auth credentials", - description: "Set authentication credentials", - }), - ), - HttpApiEndpoint.delete("authRemove", ControlPaths.auth, { - params: AuthParams, - success: Schema.Boolean, - }).annotateMerge( - OpenApi.annotations({ - identifier: "auth.remove", - summary: "Remove auth credentials", - description: "Remove authentication credentials", - }), - ), - HttpApiEndpoint.post("log", ControlPaths.log, { - query: LogQuery, - payload: LogInput, - success: Schema.Boolean, - }).annotateMerge( - OpenApi.annotations({ - identifier: "app.log", - summary: "Write log", - description: "Write a log entry to the server logs with specified level and metadata.", - }), - ), - ) - .annotateMerge(OpenApi.annotations({ title: "control", description: "Control plane routes." })), - ) +export const ControlApi = HttpApi.make("control").add( + HttpApiGroup.make("control") + .add( + HttpApiEndpoint.put("authSet", ControlPaths.auth, { + params: AuthParams, + payload: Auth.Info, + success: Schema.Boolean, + }).annotateMerge( + OpenApi.annotations({ + identifier: "auth.set", + summary: "Set auth credentials", + description: "Set authentication credentials", + }), + ), + HttpApiEndpoint.delete("authRemove", ControlPaths.auth, { + params: AuthParams, + success: Schema.Boolean, + }).annotateMerge( + OpenApi.annotations({ + identifier: "auth.remove", + summary: "Remove auth credentials", + description: "Remove authentication credentials", + }), + ), + HttpApiEndpoint.post("log", ControlPaths.log, { + query: LogQuery, + payload: LogInput, + success: Schema.Boolean, + }).annotateMerge( + OpenApi.annotations({ + identifier: "app.log", + summary: "Write log", + description: "Write a log entry to the server logs with specified level and metadata.", + }), + ), + ) + .annotateMerge(OpenApi.annotations({ title: "control", description: "Control plane routes." })), +) diff --git a/packages/opencode/src/server/routes/instance/httpapi/event.ts b/packages/opencode/src/server/routes/instance/httpapi/event.ts index 3194210cee..1d548e0baf 100644 --- a/packages/opencode/src/server/routes/instance/httpapi/event.ts +++ b/packages/opencode/src/server/routes/instance/httpapi/event.ts @@ -11,22 +11,21 @@ export const EventPaths = { event: "/event", } as const -export const EventApi = HttpApi.make("event") - .add( - HttpApiGroup.make("event") - .add( - HttpApiEndpoint.get("subscribe", EventPaths.event, { - success: Schema.Unknown, - }).annotateMerge( - OpenApi.annotations({ - identifier: "event.subscribe", - summary: "Subscribe to events", - description: "Get events", - }), - ), - ) - .annotateMerge(OpenApi.annotations({ title: "event", description: "Instance event stream route." })), - ) +export const EventApi = HttpApi.make("event").add( + HttpApiGroup.make("event") + .add( + HttpApiEndpoint.get("subscribe", EventPaths.event, { + success: Schema.Unknown, + }).annotateMerge( + OpenApi.annotations({ + identifier: "event.subscribe", + summary: "Subscribe to events", + description: "Get events", + }), + ), + ) + .annotateMerge(OpenApi.annotations({ title: "event", description: "Instance event stream route." })), +) function eventData(data: unknown) { return `data: ${JSON.stringify(data)}\n\n` diff --git a/packages/opencode/src/server/routes/instance/httpapi/global.ts b/packages/opencode/src/server/routes/instance/httpapi/global.ts index 44789b12fb..215c19ef71 100644 --- a/packages/opencode/src/server/routes/instance/httpapi/global.ts +++ b/packages/opencode/src/server/routes/instance/httpapi/global.ts @@ -37,66 +37,65 @@ export const GlobalPaths = { upgrade: "/global/upgrade", } as const -export const GlobalApi = HttpApi.make("global") - .add( - HttpApiGroup.make("global") - .add( - HttpApiEndpoint.get("health", GlobalPaths.health, { - success: GlobalHealth, - }).annotateMerge( - OpenApi.annotations({ - identifier: "global.health", - summary: "Get health", - description: "Get health information about the OpenCode server.", - }), - ), - HttpApiEndpoint.get("event", GlobalPaths.event, { - success: GlobalEvent, - }).annotateMerge( - OpenApi.annotations({ - identifier: "global.event", - summary: "Get global events", - description: "Subscribe to global events from the OpenCode system using server-sent events.", - }), - ), - HttpApiEndpoint.get("configGet", GlobalPaths.config, { - success: Config.Info, - }).annotateMerge( - OpenApi.annotations({ - identifier: "global.config.get", - summary: "Get global configuration", - description: "Retrieve the current global OpenCode configuration settings and preferences.", - }), - ), - HttpApiEndpoint.patch("configUpdate", GlobalPaths.config, { - payload: Config.Info, - success: Config.Info, - }).annotateMerge( - OpenApi.annotations({ - identifier: "global.config.update", - summary: "Update global configuration", - description: "Update global OpenCode configuration settings and preferences.", - }), - ), - HttpApiEndpoint.post("dispose", GlobalPaths.dispose, { - success: Schema.Boolean, - }).annotateMerge( - OpenApi.annotations({ - identifier: "global.dispose", - summary: "Dispose instance", - description: "Clean up and dispose all OpenCode instances, releasing all resources.", - }), - ), - HttpApiEndpoint.post("upgrade", GlobalPaths.upgrade, { - payload: GlobalUpgradeInput, - success: GlobalUpgradeResult, - }).annotateMerge( - OpenApi.annotations({ - identifier: "global.upgrade", - summary: "Upgrade opencode", - description: "Upgrade opencode to the specified version or latest if not specified.", - }), - ), - ) - .annotateMerge(OpenApi.annotations({ title: "global", description: "Global server routes." })), - ) +export const GlobalApi = HttpApi.make("global").add( + HttpApiGroup.make("global") + .add( + HttpApiEndpoint.get("health", GlobalPaths.health, { + success: GlobalHealth, + }).annotateMerge( + OpenApi.annotations({ + identifier: "global.health", + summary: "Get health", + description: "Get health information about the OpenCode server.", + }), + ), + HttpApiEndpoint.get("event", GlobalPaths.event, { + success: GlobalEvent, + }).annotateMerge( + OpenApi.annotations({ + identifier: "global.event", + summary: "Get global events", + description: "Subscribe to global events from the OpenCode system using server-sent events.", + }), + ), + HttpApiEndpoint.get("configGet", GlobalPaths.config, { + success: Config.Info, + }).annotateMerge( + OpenApi.annotations({ + identifier: "global.config.get", + summary: "Get global configuration", + description: "Retrieve the current global OpenCode configuration settings and preferences.", + }), + ), + HttpApiEndpoint.patch("configUpdate", GlobalPaths.config, { + payload: Config.Info, + success: Config.Info, + }).annotateMerge( + OpenApi.annotations({ + identifier: "global.config.update", + summary: "Update global configuration", + description: "Update global OpenCode configuration settings and preferences.", + }), + ), + HttpApiEndpoint.post("dispose", GlobalPaths.dispose, { + success: Schema.Boolean, + }).annotateMerge( + OpenApi.annotations({ + identifier: "global.dispose", + summary: "Dispose instance", + description: "Clean up and dispose all OpenCode instances, releasing all resources.", + }), + ), + HttpApiEndpoint.post("upgrade", GlobalPaths.upgrade, { + payload: GlobalUpgradeInput, + success: GlobalUpgradeResult, + }).annotateMerge( + OpenApi.annotations({ + identifier: "global.upgrade", + summary: "Upgrade opencode", + description: "Upgrade opencode to the specified version or latest if not specified.", + }), + ), + ) + .annotateMerge(OpenApi.annotations({ title: "global", description: "Global server routes." })), +) diff --git a/packages/opencode/src/server/routes/instance/httpapi/pty.ts b/packages/opencode/src/server/routes/instance/httpapi/pty.ts index 21a2dec5ce..f1ac093998 100644 --- a/packages/opencode/src/server/routes/instance/httpapi/pty.ts +++ b/packages/opencode/src/server/routes/instance/httpapi/pty.ts @@ -113,24 +113,24 @@ export const PtyApi = HttpApi.make("pty") }), ) -export const PtyConnectApi = HttpApi.make("pty-connect") - .add( - HttpApiGroup.make("pty-connect") - .add( - HttpApiEndpoint.get("connect", PtyPaths.connect, { - params: Params, - query: CursorQuery, - success: Schema.Boolean, - }).annotateMerge( - OpenApi.annotations({ - identifier: "pty.connect", - summary: "Connect to PTY session", - description: "Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.", - }), - ), - ) - .annotateMerge(OpenApi.annotations({ title: "pty", description: "PTY websocket route." })), - ) +export const PtyConnectApi = HttpApi.make("pty-connect").add( + HttpApiGroup.make("pty-connect") + .add( + HttpApiEndpoint.get("connect", PtyPaths.connect, { + params: Params, + query: CursorQuery, + success: Schema.Boolean, + }).annotateMerge( + OpenApi.annotations({ + identifier: "pty.connect", + summary: "Connect to PTY session", + description: + "Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time.", + }), + ), + ) + .annotateMerge(OpenApi.annotations({ title: "pty", description: "PTY websocket route." })), +) export const ptyHandlers = Layer.unwrap( Effect.gen(function* () { diff --git a/packages/opencode/test/server/httpapi-bridge.test.ts b/packages/opencode/test/server/httpapi-bridge.test.ts index d185dee3b2..c0482293b1 100644 --- a/packages/opencode/test/server/httpapi-bridge.test.ts +++ b/packages/opencode/test/server/httpapi-bridge.test.ts @@ -80,7 +80,9 @@ function reflectedHttpApiRoutes() { function openApiRouteKeys(spec: { paths: Record>> }) { return Object.entries(spec.paths) - .flatMap(([path, item]) => methods.filter((method) => item[method]).map((method) => `${method.toUpperCase()} ${path}`)) + .flatMap(([path, item]) => + methods.filter((method) => item[method]).map((method) => `${method.toUpperCase()} ${path}`), + ) .sort() }