<!-- Generated by scripts/ax-docs.mts from the JSDoc in registry/ouro/ax/. Do not edit; run `pnpm run docs`. -->

# ax-effects

Effect classes: a command either touches only the person's own space ("private") or reaches other people ("others"). Help groups commands under those headings, an "others" command needs `--why` and previews its audience before it acts, and its result says who can see it. `readOnly` marks reads, which change nothing.

```sh
npx shadcn@latest add ourostack/ouro-ui/ax-effects#v1.3.10
```

It installs `lib/ouro/ax/effects.ts`. Its tests are `ax-effects-tests`. Every item runs on Node 22.18 or later as it is copied: the files import each other as `./<file>.ts`. The [Ouro AX guide](ax.md) shows how they fit together.

## Exports

### `Audience`

Who can see an effect, in words a person reads: `{ only: true, who: "only you" }` or the people of a conversation.

```ts
interface Audience {
  only: boolean;
  who: string;
}
```

### `audienceLines`

The audience preview an "others" action prints before it runs, and the line its result states.

```ts
function audienceLines(a: { doing: string; done: string; where: string; as: string; who: readonly string[] | "everyone"; }): { preview: string; result: string; }
```

Example:

```ts
audienceLines({ doing: "Sending", done: "Sent", where: '"Design sync"', as: "the person", who: ["Jo Park", "Ana Ruiz"] })
```

### `DEFAULT_HEADINGS`

```ts
const DEFAULT_HEADINGS: EffectHeadings
```

### `DRY_RUN_FLAG`

The flag that previews an "others" command's effect and audience without acting.

```ts
const DRY_RUN_FLAG: "dry-run"
```

### `Effect`

Effect classes: a command either touches only the person's own space ("private") or reaches other people ("others"). Help groups commands under those headings, an "others" command needs `--why` and previews its audience before it acts, and its result says who can see it. `readOnly` marks reads, which change nothing.

```ts
type Effect = "private" | "others";
```

### `effectAnnotations`

MCP tool annotations for an effect, as [the MCP specification](https://modelcontextprotocol.io/specification/2025-06-18/server/tools) defines them.

```ts
function effectAnnotations(effect: Effect, readOnly: boolean): { readOnlyHint: boolean; destructiveHint: boolean; openWorldHint: boolean; }
```

### `EffectHeadings`

```ts
interface EffectHeadings {
  private: string;
  others: string;
}
```

### `namesLine`

"Jo Park", "Jo Park and Ana Ruiz", "Jo Park, Ana Ruiz and 3 others".

```ts
function namesLine(names: readonly string[], max?: number): string
```

### `ONLY_YOU`

```ts
const ONLY_YOU: Audience
```

### `privateResult`

The result line of a private action: what changed, and that nobody else saw it.

```ts
function privateResult(what: string): string
```

### `WHY_FLAG`

The flag an "others" command takes: who asked, and what they said.

```ts
const WHY_FLAG: "why"
```

### `WHY_PLACEHOLDER`

```ts
const WHY_PLACEHOLDER: "<who asked you, and what they said>"
```
