Skip to content

Commit 28b0359

Browse files
authored
research: delete Hono backend (do not merge) (#25667)
1 parent 32684e7 commit 28b0359

81 files changed

Lines changed: 225 additions & 7567 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bun.lock

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/src/flag/flag.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Config } from "effect"
2-
import { InstallationChannel } from "../installation/version"
32

43
function truthy(key: string) {
54
const value = process.env[key]?.toLowerCase()
@@ -11,10 +10,6 @@ function falsy(key: string) {
1110
return value === "false" || value === "0"
1211
}
1312

14-
// Channels that default to the new effect-httpapi server backend. The legacy
15-
// hono backend remains the default for stable (`prod`/`latest`) installs.
16-
const HTTPAPI_DEFAULT_ON_CHANNELS = new Set(["dev", "beta", "local"])
17-
1813
function number(key: string) {
1914
const value = process.env[key]
2015
if (!value) return undefined
@@ -88,14 +83,6 @@ export const Flag = {
8883
OPENCODE_STRICT_CONFIG_DEPS: truthy("OPENCODE_STRICT_CONFIG_DEPS"),
8984

9085
OPENCODE_WORKSPACE_ID: process.env["OPENCODE_WORKSPACE_ID"],
91-
// Defaults to true on dev/beta/local channels so internal users exercise the
92-
// new effect-httpapi server backend. Stable (`prod`/`latest`) installs stay
93-
// on the legacy hono backend until the rollout is complete. An explicit env
94-
// var ("true"/"1" or "false"/"0") always wins, providing an opt-in for
95-
// stable users and an escape hatch for dev/beta users.
96-
OPENCODE_EXPERIMENTAL_HTTPAPI:
97-
truthy("OPENCODE_EXPERIMENTAL_HTTPAPI") ||
98-
(!falsy("OPENCODE_EXPERIMENTAL_HTTPAPI") && HTTPAPI_DEFAULT_ON_CHANNELS.has(InstallationChannel)),
9986
OPENCODE_EXPERIMENTAL_WORKSPACES: OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_WORKSPACES"),
10087
OPENCODE_EXPERIMENTAL_EVENT_SYSTEM: OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_EVENT_SYSTEM"),
10188

packages/opencode/package.json

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
"node": "./src/pty/pty.node.ts",
3434
"default": "./src/pty/pty.bun.ts"
3535
},
36-
"#hono": {
37-
"bun": "./src/server/adapter.bun.ts",
38-
"node": "./src/server/adapter.node.ts",
39-
"default": "./src/server/adapter.bun.ts"
40-
},
4136
"#httpapi-server": {
4237
"bun": "./src/server/httpapi-server.node.ts",
4338
"node": "./src/server/httpapi-server.node.ts",
@@ -74,8 +69,7 @@
7469
"prettier": "3.6.2",
7570
"typescript": "catalog:",
7671
"vscode-languageserver-types": "3.17.5",
77-
"why-is-node-running": "3.2.2",
78-
"zod-to-json-schema": "3.24.5"
72+
"why-is-node-running": "3.2.2"
7973
},
8074
"dependencies": {
8175
"@actions/core": "1.11.1",
@@ -106,10 +100,6 @@
106100
"@effect/opentelemetry": "catalog:",
107101
"@effect/platform-node": "catalog:",
108102
"@gitlab/opencode-gitlab-auth": "1.3.3",
109-
"@hono/node-server": "1.19.11",
110-
"@hono/node-ws": "1.3.0",
111-
"@hono/standard-validator": "0.1.5",
112-
"@hono/zod-validator": "catalog:",
113103
"@lydell/node-pty": "catalog:",
114104
"@modelcontextprotocol/sdk": "1.27.1",
115105
"@octokit/graphql": "9.0.2",
@@ -150,8 +140,6 @@
150140
"glob": "13.0.5",
151141
"google-auth-library": "10.5.0",
152142
"gray-matter": "4.0.3",
153-
"hono": "catalog:",
154-
"hono-openapi": "catalog:",
155143
"ignore": "7.0.5",
156144
"immer": "11.1.4",
157145
"jsonc-parser": "3.3.1",
@@ -177,8 +165,7 @@
177165
"which": "6.0.1",
178166
"xdg-basedir": "5.1.0",
179167
"yargs": "18.0.0",
180-
"zod": "catalog:",
181-
"zod-to-json-schema": "3.24.5"
168+
"zod": "catalog:"
182169
},
183170
"overrides": {
184171
"drizzle-orm": "catalog:"

packages/opencode/specs/effect/http-api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# HttpApi migration
22

3+
> Historical migration notes. PR #25667 deletes the Hono backend and removes the
4+
> `OPENCODE_EXPERIMENTAL_HTTPAPI` backend selection path, so sections below that
5+
> describe Hono as the default, SDK generation from `hono-openapi`, bridge parity,
6+
> or dual-backend rollout are pre-deletion context rather than current guidance.
7+
38
Plan for replacing instance Hono route implementations with Effect `HttpApi` while preserving behavior, OpenAPI, and SDK output during the transition.
49

510
## End State

packages/opencode/src/bus/bus-event.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import z from "zod"
21
import { Schema } from "effect"
3-
import { zodObject } from "@/util/effect-zod"
42

53
export type Definition<Type extends string = string, Properties extends Schema.Top = Schema.Top> = {
64
type: Type
@@ -18,23 +16,6 @@ export function define<Type extends string, Properties extends Schema.Top>(
1816
return result
1917
}
2018

21-
export function payloads() {
22-
return registry
23-
.entries()
24-
.map(([type, def]) => {
25-
return z
26-
.object({
27-
id: z.string(),
28-
type: z.literal(type),
29-
properties: zodObject(def.properties),
30-
})
31-
.meta({
32-
ref: `Event.${def.type}`,
33-
})
34-
})
35-
.toArray()
36-
}
37-
3819
export function effectPayloads() {
3920
return registry
4021
.entries()

packages/opencode/src/cli/cmd/generate.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
11
import { Server } from "../../server/server"
22
import type { CommandModule } from "yargs"
33

4-
type Args = {
5-
httpapi: boolean
6-
hono: boolean
7-
}
4+
type Args = {}
85

96
export const GenerateCommand = {
107
command: "generate",
11-
builder: (yargs) =>
12-
yargs
13-
.option("httpapi", {
14-
type: "boolean",
15-
default: false,
16-
description:
17-
"Generate OpenAPI from the Effect HttpApi contract (default; flag retained for backwards compatibility)",
18-
})
19-
.option("hono", {
20-
type: "boolean",
21-
default: false,
22-
description: "Generate OpenAPI from the legacy Hono backend (parity-diff only; will be removed)",
23-
}),
24-
handler: async (args) => {
25-
const specs = args.hono ? await Server.openapiHono() : await Server.openapi()
8+
builder: (yargs) => yargs,
9+
handler: async () => {
10+
const specs = (await Server.openapi()) as { paths: Record<string, Record<string, any>> }
2611
for (const item of Object.values(specs.paths)) {
2712
for (const method of ["get", "post", "put", "delete", "patch"] as const) {
2813
const operation = item[method]

packages/opencode/src/control-plane/types.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Schema, Struct } from "effect"
22
import { ProjectID } from "@/project/schema"
33
import { WorkspaceID } from "./schema"
4-
import { zod } from "@/util/effect-zod"
5-
import { type DeepMutable, withStatics } from "@/util/schema"
4+
import type { DeepMutable } from "@/util/schema"
65

76
export const WorkspaceInfo = Schema.Struct({
87
id: WorkspaceID,
@@ -12,21 +11,18 @@ export const WorkspaceInfo = Schema.Struct({
1211
directory: Schema.NullOr(Schema.String),
1312
extra: Schema.NullOr(Schema.Unknown),
1413
projectID: ProjectID,
15-
})
16-
.annotate({ identifier: "Workspace" })
17-
.pipe(withStatics((s) => ({ zod: zod(s) })))
14+
}).annotate({ identifier: "Workspace" })
1815
export type WorkspaceInfo = DeepMutable<Schema.Schema.Type<typeof WorkspaceInfo>>
1916

2017
export const WorkspaceListedInfo = Schema.Struct(Struct.omit(WorkspaceInfo.fields, ["id"]))
2118
.annotate({ identifier: "WorkspaceListedInfo" })
22-
.pipe(withStatics((s) => ({ zod: zod(s) })))
2319
export type WorkspaceListedInfo = DeepMutable<Schema.Schema.Type<typeof WorkspaceListedInfo>>
2420

2521
export const WorkspaceAdapterEntry = Schema.Struct({
2622
type: Schema.String,
2723
name: Schema.String,
2824
description: Schema.String,
29-
}).pipe(withStatics((s) => ({ zod: zod(s) })))
25+
})
3026
export type WorkspaceAdapterEntry = Schema.Schema.Type<typeof WorkspaceAdapterEntry>
3127

3228
export type Target =

packages/opencode/src/control-plane/workspace.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,14 @@ import { errorData } from "@/util/error"
2828
import { waitEvent } from "./util"
2929
import { WorkspaceContext } from "./workspace-context"
3030
import { EffectBridge } from "@/effect/bridge"
31-
import { withStatics } from "@/util/schema"
32-
import { zod as effectZod, zodObject } from "@/util/effect-zod"
3331
import { Vcs } from "@/project/vcs"
3432
import { InstanceStore } from "@/project/instance-store"
3533
import { InstanceBootstrap } from "@/project/bootstrap"
3634

3735
export const Info = Schema.Struct({
3836
...WorkspaceInfoSchema.fields,
3937
timeUsed: Schema.Number,
40-
})
41-
.annotate({ identifier: "Workspace" })
42-
.pipe(withStatics((s) => ({ zod: effectZod(s) })))
38+
}).annotate({ identifier: "Workspace" })
4339
export type Info = WorkspaceInfo & { timeUsed: number }
4440

4541
export const ConnectionStatus = Schema.Struct({
@@ -88,14 +84,14 @@ export const CreateInput = Schema.Struct({
8884
branch: Info.fields.branch,
8985
projectID: ProjectID,
9086
extra: Schema.optional(Info.fields.extra),
91-
}).pipe(withStatics((s) => ({ zod: effectZod(s), zodObject: zodObject(s) })))
87+
})
9288
export type CreateInput = Schema.Schema.Type<typeof CreateInput>
9389

9490
export const SessionWarpInput = Schema.Struct({
9591
workspaceID: Schema.NullOr(WorkspaceID),
9692
sessionID: SessionID,
9793
copyChanges: Schema.optional(Schema.Boolean),
98-
}).pipe(withStatics((s) => ({ zod: effectZod(s), zodObject: zodObject(s) })))
94+
})
9995
export type SessionWarpInput = Schema.Schema.Type<typeof SessionWarpInput>
10096

10197
export class SyncHttpError extends Schema.TaggedErrorClass<SyncHttpError>()("WorkspaceSyncHttpError", {

packages/opencode/src/server/adapter.bun.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.

packages/opencode/src/server/adapter.node.ts

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)