Coven.Transmutation 2.0.1

dotnet add package Coven.Transmutation --version 2.0.1
                    
NuGet\Install-Package Coven.Transmutation -Version 2.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Coven.Transmutation" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Coven.Transmutation" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Coven.Transmutation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Coven.Transmutation --version 2.0.1
                    
#r "nuget: Coven.Transmutation, 2.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Coven.Transmutation@2.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Coven.Transmutation&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Coven.Transmutation&version=2.0.1
                    
Install as a Cake Tool

Coven.Transmutation

Pure transformations between types used across Coven. Transmuters describe how one type becomes another, without side‑effects.

What’s Inside

  • ITransmuter<TIn,TOut>: one‑way, pure transformation.
  • IBiDirectionalTransmuter<TIn,TOut>: two‑way transformation (afferent/efferent directions).
  • IBatchTransmuter<TChunk,TOutput>: many‑to‑one transformation over a window of chunks.
  • BatchTransmuteResult<TChunk,TOutput>: output plus optional remainder chunk.
  • LambdaTransmuter<TIn,TOut>: adapter to build a transmuter from a delegate.

Principles

  • Pure: no observable side‑effects (no I/O, logging, mutation of external state).
  • Deterministic: same inputs → same outputs.
  • Cancel‑aware: accept and honor CancellationToken where work may be long‑running.
  • Exception‑transparent: throw upstream; do not swallow or log.

One‑Way Transmutation

using Coven.Transmutation;

// Simple pure mapping (e.g., DTO → domain)
public sealed class UserDtoToModel : ITransmuter<UserDto, User>
{
    public Task<User> Transmute(UserDto Input, CancellationToken ct = default)
        => Task.FromResult(new User(Input.Id, Input.Name.Trim()));
}

Bidirectional Transmutation

using Coven.Transmutation;

// Two pure mappings in opposite directions (afferent/efferent)
public sealed class UserBiMap : IBiDirectionalTransmuter<UserDto, User>
{
    public Task<User> TransmuteAfferent(UserDto Input, CancellationToken ct = default)
        => Task.FromResult(new User(Input.Id, Input.Name.Trim()));

    public Task<UserDto> TransmuteEfferent(User Output, CancellationToken ct = default)
        => Task.FromResult(new UserDto { Id = Output.Id, Name = Output.Name });
}

Batch Transmutation (Many→One)

using Coven.Transmutation;

// Concatenate chunk text into a single output
public sealed class TextBatch : IBatchTransmuter<MyChunk, MyOutput>
{
    public Task<BatchTransmuteResult<MyChunk, MyOutput>> Transmute(IEnumerable<MyChunk> input, CancellationToken ct = default)
    {
        string text = string.Concat(input.Select(c => c.Text));
        return Task.FromResult(new BatchTransmuteResult<MyChunk, MyOutput>(
            new MyOutput(text),
            HasRemainder: false,
            Remainder: default));
    }
}

Remainders are useful when only part of the last chunk is consumed; the unused tail returns as Remainder to seed the next window.

Delegate Adapter

var t = new LambdaTransmuter<int, string>((i, ct) => Task.FromResult(i.ToString()));

Tips

  • Keep transmuters small and testable; stitch them together via DI.
  • Prefer immutable inputs/outputs to reinforce purity.
  • Separate policy decisions (window/shatter) from transmutation logic.

See Also

  • Architecture: Windowing and Shattering; Journaling and Scriveners.
  • Packages using transmuters: Coven.Chat, Coven.Agents, Coven.Agents.OpenAI.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Coven.Transmutation:

Package Downloads
Coven.Chat

Chat primitives and windowing integration for Coven.

Coven.Core.Streaming

Streaming/windowing utilities and daemon for chunked message flows.

Coven.Agents.OpenAI

OpenAI agent integration for Coven.

Coven.Agents

Agent abstractions and helpers for Coven.

Coven.Chat.Discord

Discord chat adapter for Coven using Discord.Net.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1 370 11/11/2025
2.0.0 354 11/11/2025