Packages

effect

4.1.4 · 11 Nov 2026MIT66.6M / weekRepositoryHomepagenpmAtom feed

Your version

4.0.2

7 Oct 2026Where it was published

4.1.5 is the newest release of 4.x.

In short

1 removed7 new77 fixed9 changed

  • Removed

    Remove gen_ai.token.type, which is not a span attribute in the current conventions, along with the token option, TokenAttributes and the AllAttributes types.

Release note

Patch Changes

  • Update AI tracing to use current OpenTelemetry GenAI conventions:

    • Replace gen_ai.system with gen_ai.provider.name. The system option, BaseAttributes and WellKnownSystem are removed in favor of provider: { name }, ProviderAttributes and WellKnownProviderName.

    • Remove gen_ai.token.type, which is not a span attribute in the current conventions, along with the token option, TokenAttributes and the AllAttributes types.

    • LanguageModel spans are client spans and record gen_ai.output.type (text or json) for every provider. The OpenAI responseFormat telemetry option and WellKnownResponseFormat are removed.

    • Move OpenAI service-tier and system-fingerprint attributes from gen_ai.openai.* to openai.*.

    • Rename concurrency, toolChoice and objectName span attributes to effect.ai.concurrency, effect.ai.tool_choice and effect.ai.object_name. Tool choices record the resolved value, defaulting to "auto"; object choices are JSON-encoded.

    • Include cached tokens in Anthropic gen_ai.usage.input_tokens and report cache reads and writes as gen_ai.usage.cache_read.input_tokens and gen_ai.usage.cache_write.input_tokens. The duplicate Anthropic cacheCreationInputTokens and cacheReadInputTokens response options are removed.

  • Fix Arbitrary property checks, schema generation, and shrinking swallowing defects or interruption when they accompany typed failures. Propagate the defect and interruption reasons with their annotations, removing typed failures from mixed causes to preserve the existing error types.

  • Include runtime layer errors in the result type of AtomRuntime.subscriptionRef.

  • Preserve the URL hash and omit empty query strings when writing Atom.searchParam.

  • Prevent Atom.windowFocusSignal and Atom.refreshOnWindowFocus from throwing when window is undefined.

  • Fix a Cache.get interruption race that could leave an abandoned lookup running and its key stuck in the cache.

  • Fix a stack overflow when many consecutive failure handlers throw synchronously. The thrown defect is now captured as the fiber's exit and pending finalizers still run.

  • Derive Channel.decodeText options from the TextDecoder constructor so declarations work with Node-only types without requiring the DOM library.

  • Fix Channel.mapInput data-last overload to preserve channel requirements and add the mapping function's requirements.

  • Fix Channel.runIntoPubSub to include the channel's error type in the returned Effect.

  • Fix compiled Struct parsers sharing mutable output when the same suspended Effect is executed more than once.

  • Preserve provider defects and interruption reasons during Config parsing, and prevent Config.orElse from recovering mixed causes.

  • Preserve separators inside Config.Record values, including base64 padding in OTLP headers.

  • Add image input to DecisionModel.decide. Providers opt in with supportsImages: true and receive images through ProviderOptions.images. Models without image support reject nonempty image input with InvalidUserInputError.

  • Fix ExecutionPlan to preserve errors and service requirements from layers, predicates, and schedules across fallback steps. Provide captured services to schedules when using captureRequirements.

  • Tag every module and directly importable export with an explicit @stability. @stability stable follows strict semver, and @stability unstable may receive breaking changes in minor releases.

  • Fix Map and Set schema equivalences incorrectly treating proper subsets as equal.

  • Fix stack overflow when many equal requests share a pending RequestResolver.withCache entry.

  • Allow interruption while waiting for permits or locks in TxSemaphore and TxReentrantLock helpers, while preserving automatic release after acquisition.

  • Allow spans without an Effect parent to inherit active OpenTelemetry spans created outside Effect.

  • Preserve finalizer defects in Effect.repeat and Effect.schedule. Prevent Effect.retry from retrying failures containing defects or interruptions.

  • Fix Toml.parse to trim an immediate opening CRLF in basic and literal multiline strings, matching its existing LF handling.

  • Fix Yaml.parse block scalar chomping to preserve trailing line breaks with keep (|+, >+) and avoid adding line breaks to empty or unterminated scalars.

  • Fix Array concatenation reducers sharing mutable empty results across calls and reducer instances.

  • Fix Standard Schema and Standard JSON Schema adapters to use the child schema rather than an inherited parent adapter.

  • Fix Stream.peel dropping the sink's unconsumed elements from a partially consumed chunk.

  • Fix suspended Schema union parsers reusing successes and issues when the same decode or encode effect is run again.

  • Fix the data-last overload of AsyncResult.flatMap to correctly infer a changed success type.

  • Fix HttpClient retaining unread responses on runtimes without FinalizationRegistry, such as Hermes.

  • Read HttpClientResponse.cookies on platforms whose Headers has no getSetCookie, such as React Native, instead of throwing.

  • Align HTTP tracing span names, response error status, server addresses and ports with OpenTelemetry conventions. Make header capture opt-in and export homogeneous primitive arrays as array attributes in @effect/opentelemetry.

  • Fix HttpServer service serve to infer required services from the middleware-transformed app.

  • Mark HttpMiddleware.tracer server spans as failed for 5xx responses, including rendered errors, without changing the application exit or existing span failure causes.

  • Report the 101 status of a successful WebSocket upgrade to server middleware such as HttpMiddleware.logger and HttpMiddleware.tracer, instead of the handler's discarded response status.

  • Fix HttpApiClient and AtomHttpApi result types for union response modes while preserving decoded-only results when the mode is omitted.

  • Fix HttpApi rejecting single-value array fields in form-urlencoded and GET payloads.

  • Return 500 and report HTTP API response encoding failures to ErrorReporter, while keeping request decoding failures at 400 and unreported. Preserve response failures as HttpApiSchemaError values for schema-error middleware.

  • Expose more of the atom registry apis

  • Cache the Kubernetes service-account token for one minute so K8sHttpClient picks up rotated credentials without reading the token file on every request.

  • Add opt-in allowSessionTermination to McpServer.layerHttp. DELETE ends the session and interrupts its active requests; later requests with that session id return 404.

    Fix an RPC cancellation race by registering request fibers before their handlers run.

  • McpServer.layerHttp uses the negotiated protocol version when a session request omits MCP-Protocol-Version. Unsupported or mismatched protocol versions, missing required MCP-Session-Id headers, and initialize requests with a session header now return JSON-RPC error bodies.

  • Fix MCP toolkit registration to require tool handler and schema services.

  • Leave interrupt-only spans Unset with an effect.fiber.interrupted: true attribute instead of Ok with an "Interrupted" description and the span.label / status.interrupted attributes. Successful spans keep Ok; failures keep Error and their exception events.

    Cause.prettyErrors no longer captures an internal stack frame for non-object failures such as Effect.fail("boom"); the stack is now the message plus the span frame, when available. This affects the exception.stacktrace exported by both tracers and the output of Cause.pretty.

  • Align OTLP and @effect/opentelemetry logs, traces, and resources with OpenTelemetry conventions.

  • OtlpMetrics exports each summary as one OTLP Summary metric named <id> instead of <id>_quantiles, <id>_count and <id>_sum Sum metrics. Summaries are always cumulative. Common unit names such as milliseconds are mapped to UCUM, and bigint values beyond 2^53 keep their precision.

  • Fix PostgreSQL SqlEventJournal writes by storing entry and remote IDs as BYTEA, and decode BIGINT timestamps returned as strings or bigints.

    Existing tables with UUID columns are not migrated automatically. Recreate both journal tables only after confirming they are empty, or externally migrate id, remote_id, and entry_id to BYTEA while preserving existing data.

  • Include completion-handler services in the requirements of McpServer.registerPrompt and McpServer.prompt, including optional handlers.

  • Prevent message loss when Queue.take, takeAll, takeN, takeBetween, poll, and clear are interrupted at a scheduler yield.

  • Fix Channel.merge hanging or succeeding when a side finalizer fails, preserving both usage and finalizer failures.

  • Fix Channel.mergeAll and concurrent Channel.flatMap dropping inner scope finalizer defects, preserving both usage and release failures.

  • Fix Cron.next returning past occurrences or exhausting its search limit when starting in a repeated DST interval.

  • Fix child fibers reusing completed transaction journals so later transactions commit their writes.

  • Fix FiberHandle losing ownership of fibers started by a synchronous replacement finalizer.

  • Fix Formatter.formatJson redaction of getter-returned values with toJSON without invoking getters twice.

  • Fix Effect.effectify so throwing error mappers become defects instead of escaping asynchronous callbacks and leaving fibers suspended.

  • Fix stack overflows when PartitionedSemaphore hands permits through long queues of synchronous tasks.

  • Fix Queue.clear swallowing failures combined with Cause.Done.

  • Fix Queue consumers defecting and messages being buffered after reentrant shutdown while resuming blocked producers.

  • Mask interruption before invoking scope finalizer callbacks so singleton cleanup completes when its callback interrupts the closing fiber.

  • Fix Stream.zipLatest, zipLatestWith, and zipLatestAll hanging when an input completes without emitting.

  • Preserve failures raised while a transaction is retrying instead of rerunning the transaction.

  • Return HTTP 200 with an empty body for empty RPC POST requests using framed serialization.

  • RPC client and server spans now set span kind client / server and record the OpenTelemetry rpc.system.name (effect_rpc) and rpc.method attributes. User spanAttributes still override them.

    Default span names are now the RPC method, for example Echo.Ping instead of RpcClient.Echo.Ping. Update dashboards, alerts or samplers that match the old names, or pass spanPrefix: "RpcClient" / spanPrefix: "RpcServer" to keep them. Spans with an explicit spanPrefix keep their existing names.

  • Fix RPC request defects breaking subsequent SchemaBinary calls after an unknown request tag or payload decoding failure.

  • Add configurable pingInterval and pingTimeout to RPC socket clients, counting any decoded server frame as liveness. Forward retryPolicy through layerProtocolSocket. The default ping interval and timeout remain 5 seconds.

  • Expose the selected tag property key through tag on schemas returned by Schema.toTaggedUnion and Schema.TaggedUnion, closes #8681.

  • Fix the data-last Sink.catchCause overload to return the handler's error type instead of the original error type.

  • Fix Stream.slidingSize dropping elements from the final partial window when windows overlap.

  • Fix SQL unencrypted event-log notifications to publish in sequence order after commit, without missing startup rows or publishing rolled-back writes.

  • Align SQL tracing with OpenTelemetry database conventions:

    • Name statement spans by db.namespace, server.address[:server.port] or db.system.name, falling back to sql.execute. The rules are exported as Statement.spanName and Statement.spanTarget.

    • Record Effect execution methods in effect.sql.method instead of db.operation.name.

    • Use internal transaction spans with effect.sql.transaction.commit|savepoint|rollback events.

    • Name D1 batches of two or more statements BATCH, or BATCH {target} when a target is set, with db.operation.name set to BATCH and db.operation.batch.size.

  • Fix Stream.groupBy, Stream.groupByKey, Stream.partition, and Stream.partitionEffect hanging when a substream consumer stops early by shutting down its queue when the consumer finishes.

  • Fix Stream.tapSink swallowing sink failures after end-of-stream.

  • Fix Channel.callback and Channel.callbackArray losing registration effect failures and defects.

  • Fix Channel.acquireUseRelease leaking resources when interrupted during acquisition.

  • Fix Floyd-Warshall path reconstruction looping on zero-cost cycles after floating-point rounding.

  • Fix Layer.buildWithMemoMap retries returning an already-finalized resource by deferring each build until execution.

  • Fix Logger.batched shutdown to finish in-flight output before flushing remaining entries, without overlapping flushes.

  • Fix Pool shutdown to wait for borrowed resources to be finalized before releasing owner scope dependencies.

  • Fix PubSub publishers accepting surplus messages after end when they yield during publishing.

  • Reject NaN and fractional PubSub capacities to prevent nonterminating batch publication, while preserving Infinity support.

  • Fix PubSub take and takeAll delivering the final message before data published during waiter registration.

  • Fix ManagedRuntime disposal deadlocking when called from one of its own fibers, including their child fibers.

  • Report ScopedCache finalizer failures during expiry and capacity eviction without failing reads or blocking replacement lookups.

  • Fix Stream.tapSink hanging when the sink finishes during an upstream pull.

  • Fix Sink.make to return successful pipeline results instead of failing with a channel completion signal.

  • Preserve one-shot iterable inputs across transaction retries in TxPriorityQueue.offerAll, TxHashMap.fromIterable/setMany/removeMany, and TxHashSet.fromIterable.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.