npm,effectified.
Effect-native packages for the libraries you already use. Typed errors, services as Layers, and interruption that cancels the call. Types derived from upstream's own, so a new upstream release fails the build instead of drifting.
Same library. Now the types say what can go wrong.
The left side is pi-ai as it ships. The right side is the same call through its effectified facade: what pi-ai does is what happens, but the failure, the timeout and the cancellation are in the type, not in your head.
import { builtinModels } from "@earendil-works/pi-ai/providers/all";
const models = builtinModels();
const model = models.getModel("anthropic", "claude-opus-4-7");
if (!model) throw new Error("no such model");
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), 30_000);
try {
const message = await models.complete(model, context, {
signal: controller.signal,
});
// A failed request resolves; you check for it.
if (message.stopReason === "error") throw new Error(message.errorMessage);
return message;
} finally {
clearTimeout(timer);
}import { anthropicProvider } from "@earendil-works/pi-ai/providers/anthropic";
import { Effect } from "effect";
import { complete, getModel, Models } from "@gunta/pi-ai-effect";
const answer = Effect.gen(function* () {
const model = yield* getModel({
provider: "anthropic",
modelId: "claude-opus-4-7",
});
return yield* complete(model, context);
}).pipe(
// Interrupting the fiber aborts the provider request.
Effect.timeout("30 seconds"),
Effect.provide(Models.layer([anthropicProvider()])),
);Every package makes the same six promises.
Learn one effectified package and you know them all. The rules are checked in CI, not just written down.
Effect, Stream or Layer
Every public function returns one. No promise, callback or any in a public signature.
Errors with names
Failures are Schema.TaggedError classes, so catchTag sees every one. Library code never throws.
Interruption cancels
Interrupting the fiber aborts the upstream call, and an upstream abort interrupts the fiber.
Upstream's types, not copies
Types derive from upstream's own. What must stay hand-written is checked by a conformance test, so an upstream change fails the build and names what moved.
One Effect
effect is a peer dependency with one range across the organization, so an app holds one copy.
Runs where Effect runs
No node: or bun: import in a package core. Platform code sits behind its own subpath export.
Decide once. Then keep up for free.
A person decides how a library maps to Effect. After that the work is mechanical, and mechanical work belongs to a machine. Today the first step is done by hand; the rest is what this organization is for.
Map the library
Which calls become Effects, which failures become tagged errors, what becomes a service, who owns cancellation.
✓ Today · by hand// proposed format
recipe("@earendil-works/pi-ai", {
service: "Models",
effects: ["complete", "stream"],
errors: { stopReason: "ModelRequestError" },
cancel: "fiber",
})Write the facade
Reads upstream's type declarations and the recipe, and writes the facade, its errors and its conformance test. The same input always writes the same output.
▲ RoadmapFollow every release
Watches upstream releases, regenerates, runs the tests and opens a pull request. A change the recipe can't place asks a person instead of guessing.
▲ Roadmap · today a sync script16 packages, one family so far.
A family is one upstream project made Effect-native: facades that add no behaviour, and plugins built on them.
Pi
| Package | Kind | Wraps | What it does |
|---|---|---|---|
| @gunta/pi-ai-effect | facade | pi-ai | Models as a service, requests as Stream and Effect, bridges to effect/ai both ways. |
| @gunta/pi-durable-effect | facade | pi-durable, pi-ai, chord | The durable agent harness as Layers, Effects and Streams. |
| @gunta/pi-schema-effect | facade | pi-schema | Effect Schema to and from Pi tool parameters, with typed decode errors. |
| @gunta/pi-telemetry-effect | facade | pi-telemetry | Pi spans, metrics and events as Effect spans, metrics and logs. |
| @gunta/pi-approvals-effect | plugin | pi-durable | Human approval of tool calls: a parking gate with typed requests and decisions. |
| @gunta/pi-budget-effect | plugin | pi-ai, pi-durable | Budget leases: reserve before each request, settle after, stop when fenced. |
| @gunta/pi-guard-effect | plugin | pi-durable | Tool allow-lists, forbidden verbs and argument rules, failing closed. |
| @gunta/pi-recorder-effect | plugin | pi-ai, pi-durable | Every message, model call and tool call to a sink, at least once, with deterministic ids. |
| @gunta/pi-review-effect | plugin | pi-ai, pi-durable | A second model of another family and a citation check before an answer stands. |
| @gunta/pi-router-effect | plugin | pi-ai | Model routes: fallback, a limiter with backoff, prices, region filters. |
| @gunta/pi-search-effect | plugin | pi-durable | Search and fetch tools behind a provider port, with an Exa adapter. |
| @gunta/pi-subagent-effect | plugin | pi-durable | Foreground and background child agents with typed results. |
| @gunta/pi-swarm-effect | plugin | pi-durable | Prime once, fork per job under a cap, typed fan-in and cleanup. |
| @gunta/pi-durable-rivet-effect | host | pi-durable, pi-ai, chord | A durable harness inside a Rivet actor: actor SQLite, schedules and forks. |
| @gunta/pi-thread-effect | composition | pi-ai, pi-durable | An agent thread: guarded, budgeted, recorded and reviewed, with subagents and swarms. |
| @gunta/pi-docs-effect | docs | – | The family's docs as pages for people and as skills for agents. |
Upstream's capability in Effect terms. Adds no behaviour.
Behaviour of ours, built on the facades.
Runs the upstream harness on another platform.
The plugins composed as a product would compose them.
The family's docs, as pages for people and skills for agents.
▲Not on npm yet. The Pi family moves to github.com/effectified and publishes as @effectified/*.
Effectify a library.Then never port it again.
Name the library you want in Effect. Bring its recipe if you know how it should map. Every family follows the same contract, so what you learn on one carries to the next.
# the Pi family, from source until it is on npm $ git clone https://github.com/gunta/pi-effect $ cd pi-effect && npm install --ignore-scripts $ npm run build