# Engine telegraph

A ship's engine order telegraph: you set an order, the other side answers by moving its own pointer to match. Both show on one dial, so a pending order is visible at a glance. For autonomy levels, deploy stages and any setting that takes effect only once acknowledged.

- Category: Instruments
- Docs: https://bevel-ui.vercel.app/components/engine-telegraph
- Import from: `@/components/ui/engine-telegraph`

## Install

```bash
npx shadcn@latest add @bevel/engine-telegraph
```

npm dependencies (installed by the CLI): `@base-ui/react`, `cn`.

## Anatomy

```tsx
<EngineTelegraph aria-label="Agent autonomy" value={value} onValueChange={setValue} confirmed={confirmed}>
  <EngineTelegraphDial />
  <EngineTelegraphOrders>
    <EngineTelegraphOrder value="ask">Ask</EngineTelegraphOrder>
    <EngineTelegraphOrder value="act">Act</EngineTelegraphOrder>
  </EngineTelegraphOrders>
  <EngineTelegraphStatus />
</EngineTelegraph>
```

## Parts

| Part | Renders | Description |
| --- | --- | --- |
| `EngineTelegraph` | div (group) + RadioGroup | value and onValueChange for your order; confirmed for the other side's answer. Give it an aria-label. |
| `EngineTelegraphDial` | div (decorative) | Your handle (dark, long) and the answer pointer (red, short) over the orders, in the order they're listed. |
| `EngineTelegraphOrders` | div | Lays out the order plates. |
| `EngineTelegraphOrder` | Radio | One order; its text is its label on the dial too. Arrow keys move between orders. |
| `EngineTelegraphStatus` | p (status) | “Ordered: Act. Waiting for confirmation”, or “Confirmed: Act.” Describes the group. |

## Example: Agent autonomy

Set how much the agent may do alone. It answers once its current step is done.

```tsx
"use client"

import * as React from "react"
import {
  EngineTelegraph,
  EngineTelegraphDial,
  EngineTelegraphOrder,
  EngineTelegraphOrders,
  EngineTelegraphStatus,
} from "@/components/ui/engine-telegraph"

/**
 * Set how much the agent may do on its own. The agent finishes its current
 * step before it answers, so the red pointer follows a moment later.
 */
export function EngineTelegraphAutonomy() {
  const [value, setValue] = React.useState("ask")
  const [confirmed, setConfirmed] = React.useState("ask")

  React.useEffect(() => {
    if (value === confirmed) return
    const timer = setTimeout(() => setConfirmed(value), 1800)
    return () => clearTimeout(timer)
  }, [value, confirmed])

  return (
    <EngineTelegraph aria-label="Agent autonomy" value={value} onValueChange={setValue} confirmed={confirmed}>
      <EngineTelegraphDial />
      <EngineTelegraphOrders>
        <EngineTelegraphOrder value="stop">Stop</EngineTelegraphOrder>
        <EngineTelegraphOrder value="plan">Plan</EngineTelegraphOrder>
        <EngineTelegraphOrder value="ask">Ask</EngineTelegraphOrder>
        <EngineTelegraphOrder value="act">Act</EngineTelegraphOrder>
        <EngineTelegraphOrder value="auto">Auto</EngineTelegraphOrder>
      </EngineTelegraphOrders>
      <EngineTelegraphStatus />
    </EngineTelegraph>
  )
}
```
