| 59 | } |
| 60 | |
| 61 | function app(input?: { password?: string; username?: string }) { |
| 62 | const handler = HttpRouter.toWebHandler( |
| 63 | HttpApiApp.routes.pipe( |
| 64 | Layer.provide( |
| 65 | ConfigProvider.layer( |
| 66 | ConfigProvider.fromUnknown({ |
| 67 | OPENCODE_SERVER_PASSWORD: input?.password, |
| 68 | OPENCODE_SERVER_USERNAME: input?.username, |
| 69 | }), |
| 70 | ), |
| 71 | ), |
| 72 | ), |
| 73 | { disableLogger: true }, |
| 74 | ).handler |
| 75 | return { |
| 76 | request(input: string | URL | Request, init?: RequestInit) { |
| 77 | return Effect.promise(() => |
| 78 | Promise.resolve( |
| 79 | handler( |
| 80 | input instanceof Request ? input : new Request(new URL(input, "http://localhost"), init), |
| 81 | HttpApiApp.context, |
| 82 | ), |
| 83 | ), |
| 84 | ) |
| 85 | }, |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | function uiApp(input?: { |
| 90 | password?: string |