aiellie

Search

Find a component, template or page

GitHub
Components

Needs You

An inbox of agents waiting on you, oldest first: approvals, questions with choices and blocked tasks, answered in place, with waits that count up and mark themselves overdue.

Needs you3

Oldest 23m
  • Waiting 23moverdue

    Run the migration against staging?

    pnpm db:migrate --env staging
  • Waiting 5m

    Which week should the report cover?

  • Waiting 1m

    Can't reach the payments sandbox. It needs a new key.

Open full screen
fig. 01 · open it full screen from the corner

Installation

npx shadcn@latest add "@aiellie/needs-you"

shadcn needs the @aiellie registry in components.json first. npx aiellie add needs-you adds it on its first run, then installs the same way.

Needs You collects every agent that's waiting on you into one list, longest wait first. An approval shows the command or file in question with Deny and Approve. A question shows its choices. A blocked task links to its thread.

Waits count up while the list is open, and turn to the destructive colour, marked overdue, past staleAfter. An answered item folds away, and focus moves to the one that takes its place.

Getting started

  1. Pass what's waiting

    Send the answer on, then take the item out of items. It folds away whoever removes it.

    components/inbox.tsx
    import { NeedsYou } from "@/components/aiellie/needs-you"
    
    export function Inbox({ waiting }: { waiting: WaitingItem[] }) {
      return (
        <NeedsYou
          items={waiting}
          onAnswer={(id, answer) => respond(id, answer)}
          onOpen={(id) => router.push(`/threads/${id}`)}
        />
      )
    }

Anatomy

<div data-slot="needs-you" role="region">
  <div data-slot="needs-you-header" />
  <ul>
    <li data-item data-leaving>
      <div data-slot="needs-you-item" data-kind="approval" data-stale role="group" />
    </li>
  </ul>
</div>

Each answer is read out with the thread it frees. The list scrolls inside the region once it's taller than its container, so give it a max-h-* where space is short.

formatWait is exported too: "now", "45s", "12m", "3h".

Examples

Read only

Without onAnswer and onOpen, it lists what's waiting with no buttons, for a summary elsewhere.

Needs you2

Oldest 10m
  • Nightly importWaiting 10moverdue

    Delete the 214 rows that failed validation?

    DELETE FROM imports WHERE status = 'invalid'
  • Onboarding emailsWaiting 45s

    Should the second email go out after 2 days or 5?

API reference

NeedsYou

PropTypeDefaultDescription
itemsWaitingItem[]required
onAnswer(id: string, answer: WaitingAnswer) => void{ kind: "approval"; approved } or { kind: "question"; answer }.
onOpen(id: string) => voidLinks each thread, and adds Open to blocked tasks.
staleAfternumber600Seconds after which a wait is overdue.

All other div props are forwarded.

WaitingItem

FieldTypeDefaultDescription
id, thread, promptstringrequired
kind"approval" | "question" | "blocked"required
detailstringShown in mono.
optionsstring[]The choices for a question.
waitingSecondsnumberrequiredHow long it had waited when the list was built.