Patch Changes
-
#6563
b6392e1Thanks @tim-smart! - unstable/reactivity Atom: addwithEqualitycombinator for customizing how the registry detects value changes -
#6574
7ed9450Thanks @tim-smart! - unstable/http HttpClientRequest: addupdateHeadersandremoveHeadercombinators for transforming or removing request headers, closes #6271 -
#6641
45762bdThanks @tim-smart! - Add manual flushing to the OTLP exporters through a sharedFlusherservice exposed by each signal layer. The signal layer output types now includeFlusher, andOtlpExporter.makerequires it so custom exporters register unconditionally. -
#6616
a6e8391Thanks @tim-smart! - AddTool.setNeedsApprovalfor replacing the approval policy of an existing tool. -
4ac7e8bThanks @IMax153! - AddEffect.updateServiceScopedfor updating a context service until the current scope closes, with customizable reset behavior. -
#6593
4cd40f5Thanks @tim-smart! - FixChannel.mergeAllto propagate outer failures promptly and interrupt active inner channels. -
#6610
6956bc0Thanks @ebramanti! - UpdateMcpServer.layerHttpto return405for unsupported HTTP methods, reject unsupportedMCP-Protocol-Versionheaders with400, and return an empty202for accepted notifications and responses. -
#6608
0e50ec7Thanks @gcanti! - AddSchema.Naturalfor non-negative safe integers and use canonicalSchema.Int,Schema.Finite, andSchema.Naturalschemas for numeric domain values across Effect, AI protocols, and OpenAPI patches.Update the date, date-time, file, time-zone, cluster, event-log, persistence, socket, SQL, and DevTools schemas to reject invalid non-finite or non-integer values where appropriate. Correct the decoded schema of
Schema.NumberFromString, and allowSchema.DurationFromMillisandSchema.DurationFromNanosto represent negative durations. -
#6599
9fcdadeThanks @tim-smart! - Interrupt in-flight stream pulls when closing an async iterator. -
#6638
57367d5Thanks @tim-smart! - FixPartitionedSemaphore.takeleaking partially acquired permits when interrupted. -
#6615
35c445fThanks @tim-smart! - Expose the tool call ID to AI tool handlers andToolkit.WithHandler.handlewrappers. -
#6561
c917bb9Thanks @hsubra89! - Reject unexpected positional arguments left after command parsing, including values exceedingArgument.variadicmaximum bounds. -
#6613
bc1f358Thanks @tim-smart! - Ignore duplicate chunk indexes when joining event log messages. -
#6552
0e0c9d7Thanks @xianjianlf2! - Fix a race where FiberHandle.clear could remove a newer fiber installed while the previous fiber was still interrupting. -
#6598
73d40aaThanks @tim-smart! - FixLanguageModel.streamTextto apply the configured concurrency limit to tool call resolution, including approval checks. -
#6637
4f1e318Thanks @tim-smart! - Fix Latch open/release resuming waiters that registered after a subsequent close.Latch.openandLatch.releaseschedule the waiter flush on the fiber's
dispatcher. Previously the flush drained whatever waiters existed at flush
time, so a waiter that registered after the latch was closed again could be
resumed by the stale flush. The waiters are now snapshotted at schedule time,
so only waiters covered by anopen/releasecall are resumed. -
#6614
9d8d85cThanks @tim-smart! - Fix histogram and summary maximum values for negative-only observations. -
#6634
6079fdaThanks @fubhy! - Fix OTLP exporter shutdown to await in-flight and final buffered exports up to the configured shutdown timeout. -
#6567
5101e92Thanks @gcanti! - AddRecord.assignPropertyand safely handle dynamic record keys such as__proto__and inherited property names. -
#6592
d0b3265Thanks @tim-smart! - FixStream.haltWhento observe halt effects at pull boundaries for synchronous streams. -
#6618
7a03c89Thanks @tim-smart! - unstable/cluster: hash over-length SQL message deduplication keys to preventmessage_idoverflow, closes #6317.The composed request deduplication key (
entityType/entityId/tag/primaryKey) can legally exceed the 255-charactermessage_idcolumn — the address columns alone allow 458 characters before the RPC primary key is appended.SqlMessageStoragenow stores a SHA-256 digest (64 hex characters) of the composed key in the uniquemessage_idcolumn when the key exceeds 255 characters, so keys of any length work on PostgreSQL, MySQL, MSSQL, and SQLite. Keys that fit are stored as plaintext, byte-compatible with rows written by previous versions, so existing deployments keep deduplicating with no migration or schema change.SqlMessageStorage.layer/layerWith(and consequentlySingleRunner.layer) now requireCrypto.Crypto. The Node and Bun cluster convenience layers provide the platform Crypto implementation internally, so their requirements are unchanged. -
#6577
cea1d9cThanks @tim-smart! - ManagedRuntime: addSymbol.asyncDispose, enablingawait usingsyntaximport { Effect, Layer, ManagedRuntime } from "effect"; await using runtime = ManagedRuntime.make(Layer.empty); await runtime.runPromise(Effect.log("Hello, world!")); // runtime is disposed automatically at the end of the scope
-
#6644
078e1f5Thanks @gcanti! - Improve the performance ofArray.dedupe,Array.union,Array.intersection,Array.difference, and Schema unique item validation by using hash-based equality lookup. -
#6609
97bafeaThanks @tim-smart! - Allow embedding usage input tokens to be omitted during decoding, including after JSON serialization. -
#6606
fab0ab8Thanks @tim-smart! - Allow optional AI response fields to be omitted during decoding, including after JSON serialization. -
#6607
c323d8bThanks @ebramanti! - Prevent MCP tool failures from exposing Cause rendering, stack traces, and internal paths while preserving actionable validation messages. -
#6576
6966353Thanks @tim-smart! - Record: makefromIterableBydual, allowing data-last usage inpipeimport { pipe, Record } from "effect"; const users = [ { id: "2", name: "name2" }, { id: "1", name: "name1" }, ]; pipe( users, Record.fromIterableBy((user) => user.id), );
-
#6622
0444004Thanks @gcanti! - Remove the experimentalSchemaUtilsmodule and itsgetNativeClassSchemahelper. The helper duplicated a composition already available through the primary Schema APIs and did not justify a separate public module. -
#6653
028bbb3Thanks @tim-smart! - RemoveEffect.withConcurrency, theReferences.CurrentConcurrencyreference backing it, and the"inherit"option fromTypes.Concurrency. Use an explicitnumberor"unbounded"concurrency value instead. -
#6620
ff5d6e2Thanks @gcanti! - MakeSchema.Datereject invalid dates and remove the redundantSchema.DateValid,Schema.isDateValid, andSchema.isDateValidReviverAPIs.Schema.DateFromStringandSchema.DateFromMillisnow fail decoding when their input would produce an invalid date.Remove
Schema.Annotations.ToArbitrary.GenerationConstraint.valid;Schema.Datearbitraries now generate only valid dates by default. -
#6575
1bfce93Thanks @gcanti! - Schema: make schemas directly extendable as classes with static method support
and removeSchema.asClass.BottomandBottomLazynow include the class-compatiblenewsignature,
whileBottomWithoutNewandBottomLazyWithoutNewexpose the schema protocol
without it for schema types that define a specialized construct signature.Example
import { Schema } from "effect"; class MyString extends Schema.String { static readonly decodeUnknownSync = Schema.decodeUnknownSync(this); } MyString.decodeUnknownSync("a"); // "a"
-
#6424
7ce815cThanks @gcanti! - Refactor theSchemaRepresentationmodule to improve clarity and maintainability.The representation pipeline is now open and compiler-extensible. The same encoded-side representation is used for JSON persistence, runtime reconstruction, JSON Schema Draft 2020-12 compilation, TypeScript code generation, AI structured output, and HTTP / OpenAPI schemas.
New representation model
- Add
RepresentationAnnotationandCheckRepresentationAnnotation, which identify declarations and checks with a stableid, JSONpayload, and optional schema dependencies. - Preserve checks on every non-reference representation node instead of storing constraints in the previous closed
metaunions. - Add compiler hooks for checks and declarations through
SchemaRepresentation.ToJsonSchemaandSchemaRepresentation.Generation. - Add
SchemaMultiDocument,fromSchemaMultiDocument, andfromRepresentationsso several live schemas and named definitions can be converted and reconstructed together. Explicit definitions are preserved even when no root references them. - Preserve shared structural nodes, annotated recursion, union member order, identifiers, reference siblings, and structural checks when projecting encoded schemas.
Persistence and revivers
- Add
toJson,fromJson,toJsonMultiDocument, andfromJsonMultiDocumentas the persistence boundary for representation documents. - Live representations store literal, enum, and property-name scalars as native values. JSON persistence encodes them as
{ type, value }tagged unions so their runtime types remain distinct across persistence formats, canonically encodes structural bigint and global symbol values, keeps JSON-valued annotations, and removes runtime-only callbacks and other non-JSON annotation values. - Replace the generic reviver callback with typed
DeclarationReviver,FilterReviver, andFilterGroupRevivercontracts. AddmakeDeclarationReviver,makeFilterReviver, andmakeFilterGroupReviver, which infer their payload type frompayloadSchema. - Resolve acyclic references to concrete runtime schemas and reserve
Schema.suspendwrappers for recursive back-edges. Acyclic alias chains may be normalized while preserving the outer reference identifier. - Export individual revivers for built-in declarations and checks from
Schema. Consumers opt in to exactly the revivers accepted when reconstructing persisted documents:- declaration revivers:
OptionReviver,ResultReviver,RedactedReviver,CauseReasonReviver,CauseReviver,ErrorReviver,ExitReviver,ReadonlyMapReviver,HashMapReviver,ReadonlySetReviver,HashSetReviver,ChunkReviver,RegExpReviver,URLReviver,DateReviver,DurationReviver,BigDecimalReviver,FileReviver,FormDataReviver,URLSearchParamsReviver,Uint8ArrayReviver,DateTimeUtcReviver,TimeZoneOffsetReviver,TimeZoneNamedReviver,TimeZoneReviver,DateTimeZonedReviver,JsonReviver, andMutableJsonReviver - check revivers:
isTrimmedReviver,isPatternReviver,isStringFiniteReviver,isStringBigIntReviver,isStringSymbolReviver,isUUIDReviver,isGUIDReviver,isULIDReviver,isBase64Reviver,isBase64UrlReviver,isStartsWithReviver,isEndsWithReviver,isIncludesReviver,isUppercasedReviver,isLowercasedReviver,isCapitalizedReviver,isUncapitalizedReviver,isFiniteReviver,isGreaterThanReviver,isGreaterThanOrEqualToReviver,isLessThanReviver,isLessThanOrEqualToReviver,isBetweenReviver,isMultipleOfReviver,isIntReviver,isDateValidReviver,isGreaterThanDateReviver,isGreaterThanOrEqualToDateReviver,isLessThanDateReviver,isLessThanOrEqualToDateReviver,isBetweenDateReviver,isGreaterThanBigIntReviver,isGreaterThanOrEqualToBigIntReviver,isLessThanBigIntReviver,isLessThanOrEqualToBigIntReviver,isBetweenBigIntReviver,isMinLengthReviver,isMaxLengthReviver,isLengthBetweenReviver,isMinSizeReviver,isMaxSizeReviver,isSizeBetweenReviver,isMinPropertiesReviver,isMaxPropertiesReviver,isPropertiesLengthBetweenReviver,isPropertyNamesReviver, andisUniqueReviver
- declaration revivers:
- Validate reviver payloads with their
payloadSchema, and report missing or duplicate reviver identifiers.
JSON Schema and code generation
- Compile JSON Schema from the canonical JSON codec and the encoded-side representation. Custom checks can contribute constraints through
Annotations.Filter.toJsonSchemawithout modifying a central metadata registry. - Import JSON Schema directly as live schemas. The importer now supports shared definitions, aliases, recursion, reference siblings, and definitions that are not reachable from a root.
- Add the named
FromJsonSchemaOptionstype for the importeronEntercallback. - Generate code from live
toCodeannotations on declarations and checks. Compiler callbacks receive generated type parameters or schema dependencies and can emit multiple import declarations. - Add import artifacts to
CodeDocumentand preserve all explicit definitions during multi-document code generation. - Reject distinct schemas that declare the same identifier instead of silently merging them or generating suffixed references.
Canonical codecs and integrations
- Preserve schema identifiers, property context, key encodings, and applicable checks while deriving canonical JSON codecs.
- Treat
Schema.JsonandSchema.MutableJsonas already canonical. JSON validation now rejects sparse arrays, and non-finite numbers decode only from the canonical strings"Infinity","-Infinity", and"NaN"rather than raw non-finite numeric inputs. - Declarations without
toCodecJsonortoCodecnow use JSON validation as their fallback instead of silently encoding tonull.toCodecJsoncallbacks may returnundefinedwhen a declaration is already canonical. - Add
Annotations.Declaration.toCodecStringTree; StringTree derivation now requires a declaration to provide a structural StringTree, JSON, or general codec instead of silently encoding an opaque declaration toundefined. - Update AI structured-output, HTTP schema, HttpApi OpenAPI, and OpenAPI generator integrations to consume the same canonical encoded representation and compiler hooks. Provider-specific structured-output transforms may remove unsupported JSON Schema keywords, while the Effect codec remains the validation authority.
Breaking changes
- Rename the low-level representation constructors:
SchemaRepresentation.fromAST->SchemaRepresentation.toRepresentationSchemaRepresentation.fromASTs->SchemaRepresentation.toRepresentations
- Replace
SchemaRepresentation.toSchemawithfromRepresentation, and addfromRepresentationsfor multi-root documents. Both reconstruction functions require{ revivers: [...] }; no default reviver is installed implicitly. - Remove
SchemaRepresentation.toSchemaDefaultReviver. Pass the required built-in revivers exported bySchema, or custom revivers created with the new constructors. - Replace
DocumentFromJsonandMultiDocumentFromJsonwith thetoJson/fromJsonandtoJsonMultiDocument/fromJsonMultiDocumentfunctions. - The persisted
DocumentandMultiDocumentformat is incompatible with the previous format. Nodes now containchecks; encoded literal values, enum values, and property signature names use tagged{ type, value }objects while decoded documents expose their native scalar values; declarations no longer containencodedSchema; persisted opaque declarations and leaf filters require a{ id, payload }representation identity; and checks no longer contain closedmetapayloads. Regenerate stored documents from their source schemas with the new API, or migrate their shape before passing them tofromJson. - Replace the generic
Reviver<T>function type withDeclarationReviver<P>,FilterReviver<P>,FilterGroupReviver<P>,CheckReviver<P>,Reviver<P>, andAnyReviver. - Remove the closed metadata types
StringMeta,NumberMeta,BigIntMeta,ArraysMeta,ObjectsMeta,DateMeta,SizeMeta,DeclarationMeta, andMetafromSchemaRepresentation. - Remove the exported representation validation schemas and
PrimitiveTree:$PrimitiveTree,$Annotations,$Null,$Undefined,$Void,$Never,$Unknown,$Any,$StringMeta,$String,$NumberMeta,$Number,$Boolean,$BigInt,$Symbol,$LiteralValue,$Literal,$UniqueSymbol,$ObjectKeyword,$Enum,$TemplateLiteral,$Element,$Arrays,$PropertySignature,$IndexSignature,$ObjectsMeta,$Objects,$Union,$Reference,$DateMeta,$SizeMeta,$DeclarationMeta,$Declaration,$Suspend,$Representation,$Document, and$MultiDocument. - Replace schema annotations as follows:
- remove
Annotations.Bottom.metaandAnnotations.Filter.meta - remove
Annotations.Declaration.typeConstructor; userepresentation - remove
Annotations.Declaration.generation; use thetoCodecallback - add
Annotations.Filter.representation,toJsonSchema, andtoCode - add
Annotations.Augment.contentSchemaas a JSON-valued annotation - allow
Annotations.Declaration.toCodecJsonandtoCodecStringTreeto returnundefined
- remove
- Remove the top-level
contentMediaTypeandcontentSchemafields fromSchemaRepresentation.String. Content metadata is now carried in ordinary annotations, andcontentSchemais a JSON Schema value rather than a nested Effect representation. - Remove
Schema.Annotations.BuiltInMetaDefinitions,BuiltInMeta,MetaDefinitions, andMeta. Custom checks should carry a representation identity and compiler callbacks instead of augmenting the metadata registry. fromJsonSchemaDocumentnow returnsSchema.Topinstead of a representationDocument.fromJsonSchemaMultiDocumentnow returnsSchemaMultiDocumentinstead ofMultiDocument; callfromSchemaMultiDocumentwhen a representation multi-document is required.toCodeDocumentnow accepts only a liveMultiDocument; remove itsreviveroption. Reconstruct persisted documents first so revivers can restore runtime compiler callbacks.- Rename the
generationfield ofArtifactvalues for symbols and enums tocode. Declaration generation no longer has anEncodedoutput, andimportDeclarationis replaced byimportDeclarationson callback output. - Remove the exported
sanitizeJavaScriptIdentifier,topologicalSort, andTopologicalSorthelpers. - Negative zero no longer receives special representation handling. Do not rely on preserving its sign across JSON persistence or generated code, where it may be normalized to
0. - With
{ errors: "all" }, structural checks run only after their base array, object, or declaration parses successfully; they are no longer added to an already failing child parse.
- Add
-
#6646
7271a7fThanks @gcanti! - Precompile union formatters and equivalences, select transformed union members using their decoded type, and allow deriving an equivalence forNever. -
#6516
475fe5cThanks @tim-smart! - Prevent SQL runner lock refreshes from hanging when reserved connections become unresponsive.