Files
anomalyco_opencode/packages/opencode/src/server/shared/tui-control.ts
T
Kit Langton 28d5650a07 refactor(server): extract Hono-coupled utilities to backend-neutral modules
Move TUI control queue, fence sync helpers, workspace routing helpers,
and the UI-asset Effect into packages/opencode/src/server/shared so the
HttpApi backend no longer reaches into Hono route files for them. The
Hono adapters (FenceMiddleware, WorkspaceRouterMiddleware, UIRoutes,
TuiRoutes) stay where they are and re-import from the neutral modules.

Pure relocation; no behavior change.
2026-05-03 00:07:03 -04:00

29 lines
561 B
TypeScript

import z from "zod"
import { AsyncQueue } from "@/util/queue"
export const TuiRequest = z.object({
path: z.string(),
body: z.any(),
})
export type TuiRequest = z.infer<typeof TuiRequest>
const request = new AsyncQueue<TuiRequest>()
const response = new AsyncQueue<unknown>()
export function nextTuiRequest() {
return request.next()
}
export function submitTuiRequest(body: TuiRequest) {
request.push(body)
}
export function submitTuiResponse(body: unknown) {
response.push(body)
}
export function nextTuiResponse() {
return response.next()
}