(handlers: ServerHandlers)
| 50 | }).pipe(Effect.ignore); |
| 51 | |
| 52 | const closeServerHandlers = async (handlers: ServerHandlers): Promise<void> => { |
| 53 | await Effect.runPromise( |
| 54 | Effect.gen(function* () { |
| 55 | yield* Effect.all( |
| 56 | [ |
| 57 | ignoreDisposeFailure("api.dispose", () => handlers.api.dispose()), |
| 58 | ignoreDisposeFailure("mcp.close", () => handlers.mcp.close()), |
| 59 | ], |
| 60 | { concurrency: "unbounded" }, |
| 61 | ); |
| 62 | // The API/MCP handlers borrow the shared local executor handle. Release it |
| 63 | // after the surfaces are closed so server shutdown (and failed startup |
| 64 | // cleanup via disposeServerHandlers) releases the owned data-dir lock. |
| 65 | yield* ignoreDisposeFailure("disposeExecutor", () => disposeExecutor()); |
| 66 | }), |
| 67 | ); |
| 68 | }; |
| 69 | |
| 70 | export const createServerHandlers = async (token: string): Promise<ServerHandlers> => { |
| 71 | let apiHandler: ServerHandlers["api"] | null = null; |
no test coverage detected