The Discord and Slack
layer for Effect UI
$ pnpm create arona-app my-botOn top of Effect UI
What Arona adds to Effect UI
Effect UI is Effect's typed component runtime. Arona gives you the Discord and Slack platforms, the interaction lifecycle, and the stores that keep a message alive.
Discord and Slack hosts
One component tree serializes to Discord Components V2 or Slack Block Kit. Each platform package owns its vocabulary, wire format, and transport.
Native message vocabulary
Containers, sections, buttons, selects, modals, file uploads, and SVG canvases are typed helpers. A misplaced element fails at serialization with a clear error.
Interaction routing
Arona assigns a stable id to every element. A click decodes to the element, dispatches its Message, and edits the message the user sees.
Commands and transports
One command definition produces options, params, and registration JSON. Run it on a gateway, an HTTP interaction endpoint, or a Cloudflare Worker.
Durable sessions
Memory, file, SQLite, D1, and KV stores. Leases and version CAS keep concurrent clicks ordered. A restart resumes the message.
Tests, traces, and DevTools
Fake channels and Slack clients test real interactions without a network. OpenTelemetry covers the interaction, and DevTools can time-travel a rendered message.
Arona does not replaceEffect UI. It supplies the platform adapter, the message lifecycle, and the operational edges around the renderer.
The shape of Arona
A complete bot in one file
Effect UI supplies the component. Arona supplies the command, the host, and the client. This file is examples/counter, compiled by the workspace.
import { UiSchema } from "effect/ui";import * as Discord from "@arona/platform-discord";import { ActionRow, Button, Container, DiscordGatewayClient, Intent, SlashCommand, Text,} from "@arona/platform-discord";import { NodeRuntime } from "@effect/platform-node";import { Config, Effect, Schema } from "effect";
const Clicked = UiSchema.TaggedEnum({ Clicked: {} });const CounterProps = Schema.Struct({ start: Schema.optional(Schema.Int) });
const Counter = Discord.component({ name: "Counter", props: CounterProps, model: Schema.Struct({ count: Schema.Finite }), message: Clicked,}).make({ init: ($) => ({ count: $.props.start ?? 0 }), update: { Clicked: ($) => $.evolve({ count: (count) => count + 1 }), }, view: (h, model) => Container(h, { children: [ Text(h, `# Count: ${model.count}`), ActionRow(h, { children: [Button(h, { onClick: Clicked.Clicked(), children: ["+1"] })], }), ], }),});
const counter = SlashCommand.make("counter", { description: "Increment a counter", options: { start: SlashCommand.integer({ description: "Starting count" }), }, component: Counter,});
const program = Effect.gen(function* () { const config = yield* Config.all({ token: Config.Redacted("DISCORD_APP_TOKEN"), clientId: Config.String("DISCORD_APP_ID"), devGuildId: Config.option(Config.String("DISCORD_DEV_GUILD_ID")), });
return yield* Effect.gen(function* () { const client = yield* DiscordGatewayClient; const user = yield* client.login; yield* Effect.log(`Logged in as ${user.username}`); return yield* Effect.never; }).pipe( Effect.provide( DiscordGatewayClient.layerEphemeral({ token: config.token, clientId: config.clientId, devGuildId: config.devGuildId, intents: [Intent.Guilds], commands: [counter], }), ), );});
NodeRuntime.runMain(program);Command and component together
The command decodes its options and passes them to the component. The same definition registers the slash command.
The host is native
Discord receives Components V2. Slack receives Block Kit. There is no embedded browser and no React runtime.
The client is included
The gateway client logs in, reloads commands, routes clicks, and edits messages. Serverless clients use the same component.
The interaction lifecycle
The platform work Arona handles
A click can arrive on a different request, process, or isolate. Arona makes the ordering explicit, then checks it.
One interaction
click │ ▼ decode custom_id │ ▼ load session ──────▶ acquire lease │ │ ▼ ▼ pure update ───────▶ CAS write (version) │ │ │ conflict │ │ ▼ ▼ render tree ◀────── heal from stored state │ ▼ edit message
The session write commits before the message is painted. A stale version returns a conflict, and the host repairs the message from stored state.
- Session, lease, target, root, and gateway-login lifecycles are XState 6 machines.
- Every machine derives one transition table, and a test checks the table against the declaration.
- Memory, file, SQLite, and D1 stores use version compare-and-swap.
- KV is explicitly eventual and is rejected on the leased session path.
- A stale click heals the message from stored state instead of overwriting a newer version.
- Fake channels and Slack clients exercise the real route without a network.
- Property tests cover stores, interaction ids, leases, node trees, and Node/Worker serializer parity.
- A bounded TLA+ model checks the session protocol with two writers.
Agent-ready
Built for agents as well as people
Arona names the platform boundary, the session states, and the failure modes. An agent can read them and change the right layer.
- One definition per concept. Command options produce the params type and the provider JSON.
- Schemas at every boundary. Props, models, messages, and session records decode at runtime.
- Tagged errors with causes. Each platform failure is repaired at the boundary that owns it.
- Named lifecycles with legal transitions, not booleans beside a Deferred.
- The generated API reference covers the Arona packages. Guides import examples that the workspace compiles.
- AGENTS.md names the stack, the gate, and the package boundaries.
Read https://djobbo.github.io/arona/ and examples/counter. Add a /poll command with one Select and one Button. Keep the model in a Schema, put the change in a pure update, and reuse the existing component helpers.
The local DevTools host can pause, time-travel, and dispatch against a rendered message. It also exposes an MCP endpoint for agent tools.Read the DevTools guide.
Deployment
Run it where your bot runs
The same component runs behind a gateway, an HTTP interaction endpoint, or a Cloudflare Worker. Pick the store that matches the runtime.
Node gateway
A long-lived client with sharding, resume, and automatic command reload.
Durable Node process
Provide @arona/store-sqlite and the client resumes messages after a restart.
Serverless HTTP
Verify Ed25519, answer inside the 3-second deadline, and defer slow work.
Cloudflare Worker
Alchemy binds D1 and KV, applies migrations, and builds a Worker client.
Slack Socket Mode
Two tokens, one socket, and the same component model on Block Kit.
Observability
Export OTLP traces and metrics, or print finished spans to the console while developing.
Quick start
Start in one command
The CLI asks for a project name, a template, and a package manager. It copies a type-checked example.
pnpm create arona-app my-botcd my-botpnpm installpnpm devBefore pnpm dev, copy .env.example to.env and add DISCORD_APP_TOKEN andDISCORD_APP_ID. The Discord guide walks through the portal.
Ship the click, not the handler
Arona keeps the message, the model, and the edit in one place. Start with the counter, then add a store and a trace.