MCPcopy Index your code
hub / github.com/anomalyco/opencode / serveEmbeddedUIEffect

Function serveEmbeddedUIEffect

packages/opencode/src/server/shared/ui.ts:64–76  ·  view source on GitHub ↗
(
  requestPath: string,
  fs: FSUtil.Interface,
  embeddedWebUI: Record<string, string>,
)

Source from the content-addressed store, hash-verified

62}
63
64export function serveEmbeddedUIEffect(
65 requestPath: string,
66 fs: FSUtil.Interface,
67 embeddedWebUI: Record<string, string>,
68) {
69 const file = embeddedWebUI[requestPath.replace(/^\//, "")] ?? embeddedWebUI["index.html"] ?? null
70 if (!file) return Effect.succeed(notFound())
71
72 return fs.readFile(file).pipe(
73 Effect.map((body) => embeddedUIResponse(file, body)),
74 Effect.catchReason("PlatformError", "NotFound", () => Effect.succeed(notFound())),
75 )
76}
77
78export function serveUIEffect(
79 request: HttpServerRequest.HttpServerRequest,

Callers 2

httpapi-ui.test.tsFile · 0.90
serveUIEffectFunction · 0.85

Calls 2

embeddedUIResponseFunction · 0.85
notFoundFunction · 0.70

Tested by

no test coverage detected