This reverts: -28b03595bresearch: delete Hono backend (do not merge) (#25667) -b24a4e897chore(server): clean up post-Hono-deletion scar tissue (#26542) v1.14.42 broke startup for users with plugins that depend on the Hono wire format (most visibly opencode-gemini-auth, see #26546). Restoring Hono as the default backend on stable channels while we investigate the actual plugin compatibility story. OPENCODE_EXPERIMENTAL_HTTPAPI flag and dual-backend selection come back. Stable installs default to Hono; dev/beta default to HTTP API. Conflict resolution: took the pre-deletion side for control-plane schemas and the seven test files where post-deletion follow-up PRs had also touched the conflicting lines. The HTTP API code added since the deletion (compression, cors-vary, fence, lifecycle log, account error mapping, etc.) is preserved as-is — those still apply on the HTTP API path for users on dev/beta channels.
55 lines
1.4 KiB
TypeScript
Executable File
55 lines
1.4 KiB
TypeScript
Executable File
#!/usr/bin/env bun
|
|
import { fileURLToPath } from "url"
|
|
|
|
const dir = fileURLToPath(new URL("..", import.meta.url))
|
|
process.chdir(dir)
|
|
|
|
import { $ } from "bun"
|
|
import path from "path"
|
|
|
|
import { createClient } from "@hey-api/openapi-ts"
|
|
|
|
const openapiSource = process.env.OPENCODE_SDK_OPENAPI === "hono" ? "hono" : "httpapi"
|
|
const opencode = path.resolve(dir, "../../opencode")
|
|
|
|
// `bun dev generate` now derives the spec from the Effect HttpApi contract by
|
|
// default; pass `--hono` to fall back to the legacy Hono spec for parity diffs.
|
|
if (openapiSource === "httpapi") {
|
|
await $`bun dev generate > ${dir}/openapi.json`.cwd(opencode)
|
|
} else {
|
|
await $`bun dev generate --hono > ${dir}/openapi.json`.cwd(opencode)
|
|
}
|
|
|
|
await createClient({
|
|
input: "./openapi.json",
|
|
output: {
|
|
path: "./src/v2/gen",
|
|
tsConfigPath: path.join(dir, "tsconfig.json"),
|
|
clean: true,
|
|
},
|
|
plugins: [
|
|
{
|
|
name: "@hey-api/typescript",
|
|
exportFromIndex: false,
|
|
},
|
|
{
|
|
name: "@hey-api/sdk",
|
|
instance: "OpencodeClient",
|
|
exportFromIndex: false,
|
|
auth: false,
|
|
paramsStructure: "flat",
|
|
},
|
|
{
|
|
name: "@hey-api/client-fetch",
|
|
exportFromIndex: false,
|
|
baseUrl: "http://localhost:4096",
|
|
},
|
|
],
|
|
})
|
|
|
|
await $`bun prettier --write src/gen`
|
|
await $`bun prettier --write src/v2`
|
|
await $`rm -rf dist`
|
|
await $`bun tsc`
|
|
await $`rm openapi.json`
|