mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-24 12:15:51 -04:00
20 lines
740 B
TypeScript
20 lines
740 B
TypeScript
import { makeDefaultApi } from "@opencode-ai/protocol/api"
|
|
import { InvalidRequestError, SessionNotFoundError } from "@opencode-ai/protocol/errors"
|
|
import { HttpApiMiddleware } from "effect/unstable/httpapi"
|
|
|
|
class LocationMiddleware extends HttpApiMiddleware.Service<LocationMiddleware>()(
|
|
"@opencode-ai/client/LocationMiddleware",
|
|
) {}
|
|
|
|
class SessionLocationMiddleware extends HttpApiMiddleware.Service<SessionLocationMiddleware>()(
|
|
"@opencode-ai/client/SessionLocationMiddleware",
|
|
{ error: [InvalidRequestError, SessionNotFoundError] },
|
|
) {}
|
|
|
|
const Api = makeDefaultApi({
|
|
locationMiddleware: LocationMiddleware,
|
|
sessionLocationMiddleware: SessionLocationMiddleware,
|
|
})
|
|
|
|
export const SessionGroup = Api.groups["server.session"]
|