The SDK uses Effect for typed results, errors, cancellation, and injected transports. It shares operation contracts with the HTTP API, CLI, and MCP server.
Build the source packages first. They are not published to npm yet. Consumers need effect@4.1.6 alongside @r2cast/sdk.
import { Effect } from "effect";
import { createClient } from "@r2cast/sdk";
const client = createClient({
url: "https://YOUR_MANAGEMENT_HOST",
headers: authorizedHeaders,
});
const shows = await Effect.runPromise(client.call("list_podcasts", {}));authorizedHeaders comes from your server-side session or scoped credential. It is not a secret to hard-code or send to a browser bundle.
Errors and retries
Validation failures, missing permission, revision conflicts, and transport errors stay distinct. Do not blindly retry a mutation with a fresh key after a timeout. Reuse its original idempotency key and read the resulting state.
Uploads use a bounded binary transport and support interruption. JSON operations return asset metadata, not media contents.
Other transports
Provide the exported Transport service for a different transport. The default HTTP transport calls the same canonical operations as MCP. Task views use a same-origin session or the host’s MCP Apps bridge.
See operations for available calls, and the package’s exported input/output schemas for the exact types.