mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-18 10:07:58 +00:00
fix(httpapi): include workspace routes in parity check
This commit is contained in:
@@ -25,6 +25,7 @@ import { McpPaths } from "./httpapi/mcp"
|
||||
import { SessionPaths } from "./httpapi/session"
|
||||
import { SyncPaths } from "./httpapi/sync"
|
||||
import { TuiPaths } from "./httpapi/tui"
|
||||
import { WorkspacePaths } from "./httpapi/workspace"
|
||||
import { ProjectRoutes } from "./project"
|
||||
import { SessionRoutes } from "./session"
|
||||
import { PtyRoutes } from "./pty"
|
||||
@@ -145,6 +146,12 @@ export const InstanceRoutes = (upgrade: UpgradeWebSocket): Hono => {
|
||||
app.post(TuiPaths.selectSession, (c) => handler(c.req.raw, context))
|
||||
app.get(TuiPaths.controlNext, (c) => handler(c.req.raw, context))
|
||||
app.post(TuiPaths.controlResponse, (c) => handler(c.req.raw, context))
|
||||
app.get(WorkspacePaths.adaptors, (c) => handler(c.req.raw, context))
|
||||
app.post(WorkspacePaths.list, (c) => handler(c.req.raw, context))
|
||||
app.get(WorkspacePaths.list, (c) => handler(c.req.raw, context))
|
||||
app.get(WorkspacePaths.status, (c) => handler(c.req.raw, context))
|
||||
app.delete(WorkspacePaths.remove, (c) => handler(c.req.raw, context))
|
||||
app.post(WorkspacePaths.sessionRestore, (c) => handler(c.req.raw, context))
|
||||
}
|
||||
|
||||
return app
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { UpgradeWebSocket } from "hono/ws"
|
||||
import { Flag } from "@opencode-ai/core/flag/flag"
|
||||
import { Instance } from "../../src/project/instance"
|
||||
import { InstanceRoutes } from "../../src/server/routes/instance"
|
||||
import { WorkspaceRoutes } from "../../src/server/routes/control/workspace"
|
||||
import { FilePaths } from "../../src/server/routes/instance/httpapi/file"
|
||||
import * as Log from "@opencode-ai/core/util/log"
|
||||
import { resetDatabase } from "../fixture/db"
|
||||
@@ -57,7 +58,11 @@ describe("HttpApi Hono bridge", () => {
|
||||
const experimental = InstanceRoutes(websocket)
|
||||
|
||||
const bridge = experimental.routes.slice(0, experimental.routes.length - legacy.routes.length)
|
||||
const legacyRoutes = [...new Set(legacy.routes.map(routeKey))]
|
||||
const workspaceRoutes = WorkspaceRoutes().routes.map((route) => ({
|
||||
...route,
|
||||
path: `/experimental/workspace${route.path === "/" ? "" : route.path}`,
|
||||
}))
|
||||
const legacyRoutes = [...new Set([...legacy.routes, ...workspaceRoutes].map(routeKey))]
|
||||
const bridgeRoutes = new Set(bridge.map(routeKey))
|
||||
|
||||
expect(legacyRoutes.filter((route) => !bridgeRoutes.has(route))).toEqual([])
|
||||
|
||||
Reference in New Issue
Block a user