CodeVetter · Repo Unpack · Data flow
effect-ts/effect
Inputs enter through execution bridges, HTTP requests, provider requests, storage calls, and framework hooks. Context supplies services, schemas transform external representations, and scoped implementations perform platform operations. Runtime contexts, router tables, databases, and atom registries own different kinds of state. Output boundaries include Promise results, encoded HTTP responses, SQL rows, persisted bytes, and UI subscriptions.
- Effect creation describes work; execution crosses runForkWith into FiberImpl.evaluate. runPromiseExitWith observes the fiber's Exit, and runPromiseWith returns its value or throws causeSquash for failure.
- ManagedRuntime's first context request builds the Layer once through a shared buildFiber, caches the resulting Context, and provides it to programs; subsequent Promise runs use runPromiseWith(cachedContext).
- HttpRouter matches method and URL, retries HEAD as GET if necessary, then places parsed search parameters and route parameters in the fiber Context before evaluating the route handler.
- handlerToHttpEffect decodes configured params, headers, query, and payload slots before calling the handler, then encodes success bodies and optional response headers. Raw handlers skip payload parsing, and returned HttpServerResponse values bypass result encoding.
- OpenAI generation converts provider options through prepareMessages, prepareTools, and prepareResponseFormat, sends POST /responses through a transformed HttpClient, schema-decodes the response, and converts it into Effect AI response parts.
- toSchemaStore builds a JSON codec: set encodes an application value before backend storage, while get reads a string and decodes it into Option.some; absent backend values become Option.none.
- SQL key-value writes encode strings to bytes and persist a value_type discriminator. Statement compiles SQL and parameters, acquires or borrows a connection, and SQLite binds parameters through StatementSync.all/run; reads reconstruct strings or Base64 binary representations.
- RegistryProvider creates one AtomRegistry for a React subtree. useAtomValue reads through that registry, optionally mapping an atom, while Promise-mode setters write then wait through AtomRegistry.getResult.