28d5650a07
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.
29 lines
561 B
TypeScript
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()
|
|
}
|