Skip to content
Night Owls.dev
Jump to a page

@nightowlsdev/react

UI

Drop-in React + Tailwind chat UI for Night Owls swarms, plus a fully headless hooks layer that renders live run state.

What it does

@nightowlsdev/react renders the live state of a swarm run, assistant messages, agent handoffs/delegation, tool activity, status, scratchpad, presence, and human-in-the-loop follow-ups/approvals, from the Night Owls wire format. Use the styled <SwarmChat> (or floating <SwarmFab>) wrapped in <SwarmProvider>, import the precompiled styles.css (no Tailwind build needed in the host), and optionally wire Supabase Realtime via the /supabase adapter for durable background runs. It merges three transports (interactive SSE, durable Realtime, hydrate/backfill) into one deduped seq-ordered log feeding a pure reducer, and parses AI SDK v7 SSE itself, so it does NOT depend on @ai-sdk/react or @mastra/*. For custom markup, import from @nightowlsdev/react/headless to get the hooks, reducer, and stream parser with no styled components; theming is via --owl-* CSS tokens, a theme prop, a classNames slot map, and an override-component registry, with the framework-agnostic @nightowlsdev/theme API re-exported. The experimental ./studio subpath adds <AgentStudio>, an embeddable admin surface for editing agent config in your database, with visual builders for per-agent rules and workflows (and a read-only workflow DAG) as the default slots since 2.7.0, keeping the JSON editors as an escape hatch. Since 2.8.0, <SwarmChat> also exposes the FR-002 client-tool seam directly via clientTools/confirmClientAction/onClientTools, so a browser-executed tool (camera, selection, upload, apply-to-scene) runs inside the adopted chat UI without rebuilding it on the raw useSwarmChat hook. As of 2.11.0 the ./studio subpath also ships <AIStudio> and <SkillStudio>, both STABLE (their props are frozen on arrival; <AgentStudio> alone remains experimental). <AIStudio> composes agents, skills, knowledge, tools and the graph workbench into ONE operator console via a section registry: a section whose client you do not pass simply does not render, sections mount lazily on first activation, readOnly can only ever NARROW what the server already permits, and graph-react is resolved at runtime so a host without that optional peer still builds. <SkillStudio> is the skill library and store, where the Import button is reachable only from a preview, because preview is what mints the server-issued token that import redeems.

Install

pnpm add @nightowlsdev/react

Key exports

  • SwarmProvider
  • useSwarm
  • SwarmChat
  • SwarmFab
  • useSwarmChat
  • useSwarmRun
  • useSwarmThreads
  • useSwarmAgents
  • useSwarmScratchpad
  • Timeline / MessageBubble / Composer / DelegationCard / AgentPile
  • ThemeEditor
  • ComponentsProvider / useComponents (override registry)
  • buildTimeline / groupTimeline
  • /headless and /supabase subpath exports
  • ./studio: AIStudio (one console with a section registry; STABLE)
  • ./studio: SkillStudio + createSkillEndpointsClient (skill library and store; STABLE)
  • ./studio (experimental): AgentStudio, RuleBuilderVisual, WorkflowBuilderVisual, WorkflowDag, useStudioFeeds

Usage

react.tsx
import { SwarmProvider, SwarmChat } from "@nightowlsdev/react";
import "@nightowlsdev/react/styles.css";

export function Room() {
  return (
    <SwarmProvider mode="dark" theme={{ "--owl-accent": "#E8A33D" }}>
      <SwarmChat agentSlug="editor" threadId="thread-1" />
    </SwarmProvider>
  );
}