You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adopt Effect across the codebase. Split out of #23, which deliberately kept the MCP server migration in plain TypeScript so the two changes stay reviewable on their own.
Why here
This code is mostly the kind of thing Effect models well, and currently hand-rolls:
Timeouts and retries.exportConfiguration threads timeoutMs / retries through every pull, and discovery sleeps timeoutMs per MIDI output.
Resource cleanup. Every path that opens MIDI ports closes them in a finally; discovery opens every input at once. These become scoped resources that close even on interruption.
Serialization. The MCP server's device lock is a hand-written promise queue; a semaphore replaces it.
Typed failures. Errors are plain Error strings today. Apply in particular has outcomes (failed vs unknown after send, stale snapshot, identity mismatch) that callers must treat differently and currently tell apart by message.
Suggested order
MIDI backend and discovery: scoped ports, timeouts.
Exporter: retries and timeouts as schedules instead of parameters.
MCP server: semaphore for the device lock; tool handlers run Effects at the edge.
Adopt Effect across the codebase. Split out of #23, which deliberately kept the MCP server migration in plain TypeScript so the two changes stay reviewable on their own.
Why here
This code is mostly the kind of thing Effect models well, and currently hand-rolls:
exportConfigurationthreadstimeoutMs/retriesthrough every pull, and discovery sleepstimeoutMsper MIDI output.finally; discovery opens every input at once. These become scoped resources that close even on interruption.Errorstrings today. Apply in particular has outcomes (failedvsunknownafter send, stale snapshot, identity mismatch) that callers must treat differently and currently tell apart by message.Suggested order
Open questions
effect/Schema? The MCP SDK accepts any Standard Schema, so tool inputs don't force zod.npx -y mft-config mcp, which starts on every agent session.