Pilot

How Firm Pilot shows its work in chat: each tool call as a trace line, its reasoning collapsed to one line, a turn's steps on a timing waterfall, and the cards it asks the lawyer to act on.

BetaReady to use. Its API can still change in a minor release; the changelog says when.

LEAP CRMBuilt for the CRM from the core library. It knows about the CRM's own records, so it isn't a general building block.

import { PilotToolCall, PilotReasoning, PilotTrace, PilotApprovalCard, PilotPermissionRequest } from "@leap-crm/design-system";

Playground

Change a prop and the component follows. Its code is under Props.

Searched contacts

Props

title
state
duration
children
icon

Best practices

When to use it, and the rules that apply in particular places.

GuidancePractice
DoWrite a tool call's title in its tense: “Searching contacts” while it runs, “Searched contacts” once it's done.
DoUse PilotPermissionRequest for a write Firm Pilot holds for approval, so the held tool row sits directly above its card. Use PilotApprovalCard alone for a choice that holds no write.
DoMark one option primary, the action the card exists for, and a delete or discard destructive. The rest render as outline buttons.
DoReturn a Promise from onSelect, so the chosen button spins until it settles and then shows a tick or a cross.
DoSet readOnly without selectedValue when a card has gone stale. It swaps its buttons for a line saying so, since faded buttons invite a tap that does nothing.
Don'tOpen PilotReasoning by default once Firm Pilot has finished. It collapses to one line, like “Reasoned for 4s”, so the answer leads and the lawyer opens the reasoning when they want it.

Props

PilotToolCall

PropTypeDefaultDescription
title *string—What the call does, in its tense: "Searching contacts", "Searched contacts".
icon *ReactNode—The tool's 14 px icon; it takes the state's tone.
state *"running" | "done" | "failed" | "held" | "recovered"—running, done, failed, held (waiting on a person) or recovered.
heldChangestring—For a held write: what it will change, after the title.
durationnumber—Seconds the call took. Not shown while it runs.
childrenReactNode—What the row shows when opened, on a line down its left.
openboolean—Whether it's open, when you control it.
defaultOpenboolean—Whether it starts open, when it controls itself.
onOpenChange(open: boolean) => void—Runs when it opens or closes, with whether it's now open.

PilotReasoning

PropTypeDefaultDescription
streamingbooleanfalseFirm Pilot is still reasoning: the brain breathes and the label says so.
durationnumber—Seconds it reasoned for, once done.
childrenReactNode—The reasoning, as prose.
openboolean—Whether it's open, when you control it.
defaultOpenbooleanfalseCollapsed by default once done.
onOpenChange(open: boolean) => void—Runs when it opens or closes, with whether it's now open.

PilotTrace

PropTypeDefaultDescription
steps *PilotTraceStep[]—The tool calls, in order, each as a PilotToolCall's props.
totalnumber—The turn's whole time in seconds. Defaults to the end of the last step.
openboolean—Whether it's open, when you control it.
defaultOpenbooleanfalseWhether it starts open, when it controls itself.
onOpenChange(open: boolean) => void—Runs when it opens or closes, with whether it's now open.

PilotApprovalCard

PropTypeDefaultDescription
title *ReactNode—What Firm Pilot wants to do, as a question or statement.
details{ label: string; value: ReactNode }[][]Label and value rows under the title.
options *PilotCardOption[]—The choices, as buttons. One is primary: the action the card exists for.
onSelect *(value: string) => unknown—Runs with the chosen option's value. Return a Promise and the button spins until it settles, then draws a tick (or a cross if it fails).
readOnlybooleanfalseNo longer actionable: after a pick, or when the card has gone stale.
selectedValuestring—The option the lawyer picked, once they have.
childrenReactNode—Extra content between the details and the actions, like an email draft.

PilotPermissionRequest

PropTypeDefaultDescription
title *ReactNode—What Firm Pilot wants to do, as a question or statement.
details{ label: string; value: ReactNode }[]—Label and value rows under the title.
options *PilotCardOption[]—The choices, as buttons. One is primary: the action the card exists for.
onSelect *(value: string) => unknown—Runs with the chosen option's value. Return a Promise and the button spins until it settles, then draws a tick (or a cross if it fails).
readOnlyboolean—No longer actionable: after a pick, or when the card has gone stale.
selectedValuestring—The option the lawyer picked, once they have.
childrenReactNode—Extra content between the details and the actions, like an email draft.
toolTitle *string—The held write's title, like "Update Jane Citizen's email".
toolIcon *ReactNode—The icon of the tool asking, as on its tool call.
heldChangestring—What the held write will change, after the tool's title.

Code

What the playground shows, ready to copy.

import { PilotToolCall, PlusIcon } from "@leap-crm/design-system";

<PilotToolCall
  title="Searched contacts"
  state="done"
  icon={<PlusIcon />}
/>

Reasoning

Reasoning... while Firm Pilot thinks, with the brain breathing; Reasoned for 4s once done, collapsed by default.

Trace waterfall

A turn's steps with their timing on a shared scale. A retried first try's bar is grey, a failure's red. The bars are decoration; durations stay as text.

  1. Searched contacts
    1.2s
  2. Read Agency Purchase
    2.1s
  3. Reading the matterRetried
    0.6s
  4. Read the matter
    2.9s

Settling

When a call you watched running finishes, its icon turns into a tick that draws itself in (or a cross if it failed), holds a moment, then turns back into the tool's icon in its new tone. A call that arrives already settled just shows its icon, so a long trace doesn't flash.

Searched contacts1.4s
Couldn't read the costs agreement2s

Approval card

Primary for the one action the card exists for, Outline for others, Destructive for discarding. Pick one: it spins while onSelect's Promise runs, then resolves into a tick that stays on the chosen button, and the others fade. A stale card swaps its buttons for a line saying so.

Update Jane Citizen

Email
jane@citizenlegal.com.au
Phone
0400 000 000
Source
Signature in her 14 Nov email

Update Jane Citizen

Email
jane@citizenlegal.com.au
Phone
0400 000 000
Source
Signature in her 14 Nov email

This card is no longer current — ask Firm Pilot to show it again.

Permission request

A write Firm Pilot holds for approval: the held tool row directly above its card.

Update Jane Citizen’s emailWaiting for your OK

Update Jane Citizen

Email
jane@citizenlegal.com.au
Phone
0400 000 000
Source
Signature in her 14 Nov email

What the examples share

The imports and the scaffolding the examples above call. The scaffolding lives in this page, not in the library.

import { FileText, Pencil, Search } from "lucide-react";

import { useState } from "react";

import { Button, PilotApprovalCard, PilotPermissionRequest, PilotReasoning, PilotToolCall, PilotTrace } from "@leap-crm/design-system";

const options = [
  { value: "approve", label: "Approve", variant: "primary" as const },
  { value: "edit", label: "Edit first" },
  { value: "discard", label: "Discard", variant: "destructive" as const },
];

const details = [
  { label: "Email", value: "jane@citizenlegal.com.au" },
  { label: "Phone", value: "0400 000 000" },
  { label: "Source", value: "Signature in her 14 Nov email" },
];

const wait = (ms: number) =>
  new Promise<void>(resolve => {
    setTimeout(resolve, ms);
  });

function ApprovalDemo() {
  const [picked, setPicked] = useState<string>();
  // Firm Pilot takes a moment to apply the pick; the button spins, then ticks.
  const select = async (value: string) => {
    await wait(900);
    setPicked(value);
  };
  return (
    <div className="flex flex-wrap items-start gap-4">
      <PilotApprovalCard
        title="Update Jane Citizen"
        details={details}
        options={options}
        onSelect={select}
        readOnly={picked !== undefined}
        selectedValue={picked}
      />
      <PilotApprovalCard
        title="Update Jane Citizen"
        details={details}
        options={options}
        onSelect={() => undefined}
        readOnly
      />
    </div>
  );
}

type Step = "running" | "done" | "failed";

function SettlingDemo() {
  const [search, setSearch] = useState<Step>("done");
  const [write, setWrite] = useState<Step>("failed");
  const run = () => {
    setSearch("running");
    setWrite("running");
    setTimeout(() => setSearch("done"), 1400);
    setTimeout(() => setWrite("failed"), 2000);
  };
  return (
    <div className="flex flex-col items-start gap-3">
      <div className="flex flex-col">
        <PilotToolCall
          title={
            search === "running" ? "Searching contacts" : "Searched contacts"
          }
          icon={<Search />}
          state={search}
          duration={search === "running" ? undefined : 1.4}
        />
        <PilotToolCall
          title={
            write === "running"
              ? "Reading the costs agreement"
              : "Couldn't read the costs agreement"
          }
          icon={<FileText />}
          state={write}
          duration={write === "running" ? undefined : 2}
        />
      </div>
      <Button intent="outline" size="sm" onClick={run}>
        Run again
      </Button>
    </div>
  );
}

Keyboard

The keys it answers to. Tab moves between components, arrows move within them.

KeysWhat they do
EnterSpaceToggle the focused section and keep focus on its trigger.
TabMoves from an open trigger into its panel, and skips a closed one.