GeezerVison is showing github.com — research: delete Hono backend (do not merge) (#25667) · githubhjs/opencode@28b0359
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: bun.lock -10Lines changed: 0 additions & 10 deletions Collapse file Copy file name to clipboardExpand all lines: packages/core/src/flag/flag.ts -13Lines changed: 0 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { Config } from "effect" | 2 | | -import { InstallationChannel } from "../installation/version" | 3 | 2 |
| 4 | 3 | function truthy(key: string) { | 5 | 4 | const value = process.env[key]?.toLowerCase() | @@ -11,10 +10,6 @@ function falsy(key: string) { | 11 | 10 | return value === "false" || value === "0" | 12 | 11 | } | 13 | 12 |
| 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 | | - | 18 | 13 | function number(key: string) { | 19 | 14 | const value = process.env[key] | 20 | 15 | if (!value) return undefined | @@ -88,14 +83,6 @@ export const Flag = { | 88 | 83 | OPENCODE_STRICT_CONFIG_DEPS: truthy("OPENCODE_STRICT_CONFIG_DEPS"), | 89 | 84 |
| 90 | 85 | 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)), | 99 | 86 | OPENCODE_EXPERIMENTAL_WORKSPACES: OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_WORKSPACES"), | 100 | 87 | OPENCODE_EXPERIMENTAL_EVENT_SYSTEM: OPENCODE_EXPERIMENTAL || truthy("OPENCODE_EXPERIMENTAL_EVENT_SYSTEM"), | 101 | 88 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/package.json +2-15Lines changed: 2 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 33 | 33 | "node": "./src/pty/pty.node.ts", | 34 | 34 | "default": "./src/pty/pty.bun.ts" | 35 | 35 | }, | 36 | | - "#hono": { | 37 | | - "bun": "./src/server/adapter.bun.ts", | 38 | | - "node": "./src/server/adapter.node.ts", | 39 | | - "default": "./src/server/adapter.bun.ts" | 40 | | - }, | 41 | 36 | "#httpapi-server": { | 42 | 37 | "bun": "./src/server/httpapi-server.node.ts", | 43 | 38 | "node": "./src/server/httpapi-server.node.ts", | | 74 | 69 | "prettier": "3.6.2", | 75 | 70 | "typescript": "catalog:", | 76 | 71 | "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" | 79 | 73 | }, | 80 | 74 | "dependencies": { | 81 | 75 | "@actions/core": "1.11.1", | | 106 | 100 | "@effect/opentelemetry": "catalog:", | 107 | 101 | "@effect/platform-node": "catalog:", | 108 | 102 | "@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:", | 113 | 103 | "@lydell/node-pty": "catalog:", | 114 | 104 | "@modelcontextprotocol/sdk": "1.27.1", | 115 | 105 | "@octokit/graphql": "9.0.2", | | 150 | 140 | "glob": "13.0.5", | 151 | 141 | "google-auth-library": "10.5.0", | 152 | 142 | "gray-matter": "4.0.3", | 153 | | - "hono": "catalog:", | 154 | | - "hono-openapi": "catalog:", | 155 | 143 | "ignore": "7.0.5", | 156 | 144 | "immer": "11.1.4", | 157 | 145 | "jsonc-parser": "3.3.1", | | 177 | 165 | "which": "6.0.1", | 178 | 166 | "xdg-basedir": "5.1.0", | 179 | 167 | "yargs": "18.0.0", | 180 | | - "zod": "catalog:", | 181 | | - "zod-to-json-schema": "3.24.5" | | 168 | + "zod": "catalog:" | 182 | 169 | }, | 183 | 170 | "overrides": { | 184 | 171 | "drizzle-orm": "catalog:" | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/specs/effect/http-api.md +5Lines changed: 5 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # HttpApi migration | 2 | 2 |
| | 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 | +
| 3 | 8 | Plan for replacing instance Hono route implementations with Effect `HttpApi` while preserving behavior, OpenAPI, and SDK output during the transition. | 4 | 9 |
| 5 | 10 | ## End State | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/bus/bus-event.ts -19Lines changed: 0 additions & 19 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -import z from "zod" | 2 | 1 | import { Schema } from "effect" | 3 | | -import { zodObject } from "@/util/effect-zod" | 4 | 2 |
| 5 | 3 | export type Definition<Type extends string = string, Properties extends Schema.Top = Schema.Top> = { | 6 | 4 | type: Type | @@ -18,23 +16,6 @@ export function define<Type extends string, Properties extends Schema.Top>( | 18 | 16 | return result | 19 | 17 | } | 20 | 18 |
| 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 | | - | 38 | 19 | export function effectPayloads() { | 39 | 20 | return registry | 40 | 21 | .entries() | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/generate.ts +4-19Lines changed: 4 additions & 19 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { Server } from "../../server/server" | 2 | 2 | import type { CommandModule } from "yargs" | 3 | 3 |
| 4 | | -type Args = { | 5 | | - httpapi: boolean | 6 | | - hono: boolean | 7 | | -} | | 4 | +type Args = {} | 8 | 5 |
| 9 | 6 | export const GenerateCommand = { | 10 | 7 | 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>> } | 26 | 11 | for (const item of Object.values(specs.paths)) { | 27 | 12 | for (const method of ["get", "post", "put", "delete", "patch"] as const) { | 28 | 13 | const operation = item[method] | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/control-plane/types.ts +3-7Lines changed: 3 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { Schema, Struct } from "effect" | 2 | 2 | import { ProjectID } from "@/project/schema" | 3 | 3 | 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" | 6 | 5 |
| 7 | 6 | export const WorkspaceInfo = Schema.Struct({ | 8 | 7 | id: WorkspaceID, | @@ -12,21 +11,18 @@ export const WorkspaceInfo = Schema.Struct({ | 12 | 11 | directory: Schema.NullOr(Schema.String), | 13 | 12 | extra: Schema.NullOr(Schema.Unknown), | 14 | 13 | projectID: ProjectID, | 15 | | -}) | 16 | | - .annotate({ identifier: "Workspace" }) | 17 | | - .pipe(withStatics((s) => ({ zod: zod(s) }))) | | 14 | +}).annotate({ identifier: "Workspace" }) | 18 | 15 | export type WorkspaceInfo = DeepMutable<Schema.Schema.Type<typeof WorkspaceInfo>> | 19 | 16 |
| 20 | 17 | export const WorkspaceListedInfo = Schema.Struct(Struct.omit(WorkspaceInfo.fields, ["id"])) | 21 | 18 | .annotate({ identifier: "WorkspaceListedInfo" }) | 22 | | - .pipe(withStatics((s) => ({ zod: zod(s) }))) | 23 | 19 | export type WorkspaceListedInfo = DeepMutable<Schema.Schema.Type<typeof WorkspaceListedInfo>> | 24 | 20 |
| 25 | 21 | export const WorkspaceAdapterEntry = Schema.Struct({ | 26 | 22 | type: Schema.String, | 27 | 23 | name: Schema.String, | 28 | 24 | description: Schema.String, | 29 | | -}).pipe(withStatics((s) => ({ zod: zod(s) }))) | | 25 | +}) | 30 | 26 | export type WorkspaceAdapterEntry = Schema.Schema.Type<typeof WorkspaceAdapterEntry> | 31 | 27 |
| 32 | 28 | export type Target = | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/control-plane/workspace.ts +3-7Lines changed: 3 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,18 +28,14 @@ import { errorData } from "@/util/error" | 28 | 28 | import { waitEvent } from "./util" | 29 | 29 | import { WorkspaceContext } from "./workspace-context" | 30 | 30 | import { EffectBridge } from "@/effect/bridge" | 31 | | -import { withStatics } from "@/util/schema" | 32 | | -import { zod as effectZod, zodObject } from "@/util/effect-zod" | 33 | 31 | import { Vcs } from "@/project/vcs" | 34 | 32 | import { InstanceStore } from "@/project/instance-store" | 35 | 33 | import { InstanceBootstrap } from "@/project/bootstrap" | 36 | 34 |
| 37 | 35 | export const Info = Schema.Struct({ | 38 | 36 | ...WorkspaceInfoSchema.fields, | 39 | 37 | timeUsed: Schema.Number, | 40 | | -}) | 41 | | - .annotate({ identifier: "Workspace" }) | 42 | | - .pipe(withStatics((s) => ({ zod: effectZod(s) }))) | | 38 | +}).annotate({ identifier: "Workspace" }) | 43 | 39 | export type Info = WorkspaceInfo & { timeUsed: number } | 44 | 40 |
| 45 | 41 | export const ConnectionStatus = Schema.Struct({ | @@ -88,14 +84,14 @@ export const CreateInput = Schema.Struct({ | 88 | 84 | branch: Info.fields.branch, | 89 | 85 | projectID: ProjectID, | 90 | 86 | extra: Schema.optional(Info.fields.extra), | 91 | | -}).pipe(withStatics((s) => ({ zod: effectZod(s), zodObject: zodObject(s) }))) | | 87 | +}) | 92 | 88 | export type CreateInput = Schema.Schema.Type<typeof CreateInput> | 93 | 89 |
| 94 | 90 | export const SessionWarpInput = Schema.Struct({ | 95 | 91 | workspaceID: Schema.NullOr(WorkspaceID), | 96 | 92 | sessionID: SessionID, | 97 | 93 | copyChanges: Schema.optional(Schema.Boolean), | 98 | | -}).pipe(withStatics((s) => ({ zod: effectZod(s), zodObject: zodObject(s) }))) | | 94 | +}) | 99 | 95 | export type SessionWarpInput = Schema.Schema.Type<typeof SessionWarpInput> | 100 | 96 |
| 101 | 97 | export class SyncHttpError extends Schema.TaggedErrorClass<SyncHttpError>()("WorkspaceSyncHttpError", { | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/server/adapter.bun.ts -44Lines changed: 0 additions & 44 deletions Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/server/adapter.node.ts -75Lines changed: 0 additions & 75 deletions
|