# Effection — Structured Concurrency for JavaScript > Effection is a JavaScript library for building reliable asynchronous and > concurrent programs using structured concurrency. Effection models async work as **lazy operations** with explicit lifetimes, deterministic cancellation, and guaranteed cleanup. It uses **generator functions (`function*`)**, not `async` / `await`, to express long-lived, cancellable work. --- ## IMPORTANT FOR AI AGENTS If you will **write, modify, refactor, or debug Effection code**, you **must** read [AGENTS.md] first. **AGENTS.md is the normative behavioral contract.** - Do not invent APIs - Do not infer semantics from Promises or other ecosystems - Do not substitute primitives that "look equivalent" - If information is missing or uncertain, consult the API reference If any other document conflicts with AGENTS.md, **AGENTS.md takes precedence**. --- ## Where to look (routing) - **Behavioral rules & invariants (authoritative):** [AGENTS.md] - **Public API reference (authoritative):** [API] - **Conceptual guides & explanations (human-oriented):** [Guides] - [Thinking in Effection] - [Async Rosetta Stone] - [Operations] - [Scope] - [Resources] - [Spawn] - [Collections] - [Browse all guides][Guides] --- ## EffectionX Packages Extension packages for common JavaScript tasks. Install from npm (`@effectionx/*`). ### Testing Test frameworks, adapters, and assertion helpers - [@effectionx/bdd](https://pr-1207--effection.netlify.app/x/bdd.md): BDD testing harness with describe/it/beforeEach for Effection operations - [@effectionx/converge](https://pr-1207--effection.netlify.app/x/converge.md): Poll and wait for conditions to be met with automatic retry and timeout - [@effectionx/test-adapter](https://pr-1207--effection.netlify.app/x/test-adapter.md): Abstract helper for integrating Effection with testing frameworks - [@effectionx/vitest](https://pr-1207--effection.netlify.app/x/vitest.md): Vitest adapter for writing tests as Effection generator functions ### I/O & Network HTTP, WebSocket, file system, and Node.js adapters - [@effectionx/fetch](https://pr-1207--effection.netlify.app/x/fetch.md): Effection-native fetch with structured concurrency and streaming response support - [@effectionx/fs](https://pr-1207--effection.netlify.app/x/fs.md): File system operations wrapped as Effection operations - [@effectionx/jsonl-store](https://pr-1207--effection.netlify.app/x/jsonl-store.md): Streaming JSONL document store with glob-based file selection - [@effectionx/node](https://pr-1207--effection.netlify.app/x/node.md): Node. - [@effectionx/websocket](https://pr-1207--effection.netlify.app/x/websocket.md): WebSocket client with stream-based message handling and automatic cleanup ### Processes Child process management and file watching - [@effectionx/process](https://pr-1207--effection.netlify.app/x/process.md): Spawn and manage child processes with structured concurrency - [@effectionx/tinyexec](https://pr-1207--effection.netlify.app/x/tinyexec.md): Lightweight process execution wrapper around tinyexec - [@effectionx/watch](https://pr-1207--effection.netlify.app/x/watch.md): Run commands and restart them gracefully when source files change ### Streams Stream transformation, parsing, and storage - [@effectionx/fetch](https://pr-1207--effection.netlify.app/x/fetch.md): Effection-native fetch with structured concurrency and streaming response support - [@effectionx/jsonl-store](https://pr-1207--effection.netlify.app/x/jsonl-store.md): Streaming JSONL document store with glob-based file selection - [@effectionx/node](https://pr-1207--effection.netlify.app/x/node.md): Node. - [@effectionx/raf](https://pr-1207--effection.netlify.app/x/raf.md): Stream of requestAnimationFrame updates for Effection - [@effectionx/stream-helpers](https://pr-1207--effection.netlify.app/x/stream-helpers.md): Type-safe stream operators like filter, map, reduce, and forEach - [@effectionx/stream-yaml](https://pr-1207--effection.netlify.app/x/stream-yaml.md): Parse streams of strings as YAML documents - [@effectionx/websocket](https://pr-1207--effection.netlify.app/x/websocket.md): WebSocket client with stream-based message handling and automatic cleanup ### Concurrency Rate limiting, timeouts, and flow control - [@effectionx/context-api](https://pr-1207--effection.netlify.app/x/context-api.md): Algebraic effects pattern for context-dependent operations with middleware - [@effectionx/converge](https://pr-1207--effection.netlify.app/x/converge.md): Poll and wait for conditions to be met with automatic retry and timeout - [@effectionx/inline](https://pr-1207--effection.netlify.app/x/inline.md): Optimize deeply nested operations by collapsing yield delegation into a single iterator - [@effectionx/middleware](https://pr-1207--effection.netlify.app/x/middleware.md): Type-safe composable middleware for generators and Effection operations - [@effectionx/scope-eval](https://pr-1207--effection.netlify.app/x/scope-eval.md): Evaluate operations in a scope while retaining resources across evaluations - [@effectionx/task-buffer](https://pr-1207--effection.netlify.app/x/task-buffer.md): Limit concurrent task execution with automatic queuing - [@effectionx/timebox](https://pr-1207--effection.netlify.app/x/timebox.md): Constrain operations to complete within a time limit ### Reactivity Reactive state and async workflows - [@effectionx/signals](https://pr-1207--effection.netlify.app/x/signals.md): Reactive signals and computed values for Effection operations ### Interop Integration with other ecosystems and patterns - [@effectionx/chain](https://pr-1207--effection.netlify.app/x/chain.md): Promise-like chaining with then/catch/finally for Effection operations - [@effectionx/context-api](https://pr-1207--effection.netlify.app/x/context-api.md): Algebraic effects pattern for context-dependent operations with middleware - [@effectionx/effect-ts](https://pr-1207--effection.netlify.app/x/effect-ts.md): Bidirectional interop between Effect-TS and Effection - [@effectionx/fx](https://pr-1207--effection.netlify.app/x/fx.md): Utility functions for async workflows adapted from starfx - [@effectionx/middleware](https://pr-1207--effection.netlify.app/x/middleware.md): Type-safe composable middleware for generators and Effection operations - [@effectionx/test-adapter](https://pr-1207--effection.netlify.app/x/test-adapter.md): Abstract helper for integrating Effection with testing frameworks ### Platform Browser and runtime-specific APIs - [@effectionx/raf](https://pr-1207--effection.netlify.app/x/raf.md): Stream of requestAnimationFrame updates for Effection - [@effectionx/worker](https://pr-1207--effection.netlify.app/x/worker.md): Web Worker integration with two-way messaging and graceful shutdown ## Optional - [Full EffectionX catalog with documentation](https://pr-1207--effection.netlify.app/x/) - [Effection Blog](https://pr-1207--effection.netlify.app/blog) --- [AGENTS.md]: https://pr-1207--effection.netlify.app/AGENTS.md [API]: https://pr-1207--effection.netlify.app/api.md [Guides]: https://pr-1207--effection.netlify.app/guides/v4 [Thinking in Effection]: https://pr-1207--effection.netlify.app/guides/v4/thinking-in-effection.md [Async Rosetta Stone]: https://pr-1207--effection.netlify.app/guides/v4/async-rosetta-stone.md [Operations]: https://pr-1207--effection.netlify.app/guides/v4/operations.md [Scope]: https://pr-1207--effection.netlify.app/guides/v4/scope.md [Resources]: https://pr-1207--effection.netlify.app/guides/v4/resources.md [Spawn]: https://pr-1207--effection.netlify.app/guides/v4/spawn.md [Collections]: https://pr-1207--effection.netlify.app/guides/v4/collections.md