Implement, debug, refactor, migrate, review, or explain Effect TypeScript code. Use when a task touches `effect` or `@effect/*` APIs, especially services, layers, schemas, runtime wiring, platform or CLI packages, Effect testing, or Promise-to-Effect migration.
98
100%
Does it follow best practices?
Impact
93%
1.16xAverage score across 3 eval scenarios
Passed
No known issues
You are working on a backend service that interacts with a document storage SDK. The current implementation uses raw async/await and scatters Promise conversions throughout the codebase. Your job is to migrate the integration to idiomatic Effect TypeScript.
The project is at /workspace/scenario-3-project/. It has effect and @effect/platform-node installed. The existing code lives in src/storage/.
The SDK (DocumentStoreClient) has many operations (upload, download, delete, list, getMetadata, setMetadata, createFolder, etc.) and each returns a Promise. The SDK also accepts an optional AbortSignal on each call.
The existing file src/storage/legacy.ts shows the current async/await implementation (read it for context on how the SDK is used and what errors it throws).
Write the following new files:
/workspace/scenario-3-project/src/storage/DocumentStore.ts — the Effect service wrapping the SDK/workspace/scenario-3-project/src/storage/errors.ts — typed error definitions for SDK failures/workspace/scenario-3-project/src/storage/index.ts — barrel exportAdditionally, in /workspace/scenario-3-project/src/app.ts, there is a React-like framework callback that needs to call Effect code. Update it to use a runtime approach appropriate for a non-Effect host environment executing Effect code repeatedly.