Skip to content

Commit 5786588

Browse files
mschristensenclaude
andcommitted
docs: apply inline code formatting conventions to all doc pages
Add parentheses to all backticked function and hook references in prose text across 24 doc pages, per the inline code formatting rules in the docs skill (e.g. `useChat` → `useChat()`, `streamResponse` → `streamResponse()`). Type and interface names remain without parens. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 972736b commit 5786588

28 files changed

+120
-120
lines changed

docs/concepts/transport.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ For the internal implementation of each transport, see [Client transport](../int
104104

105105
| You want to... | Use this entry point |
106106
|---|---|
107-
| Build with Vercel AI SDK's `useChat` | `@ably/ai-transport/vercel/react` - gives you `useChatTransport` + `useMessageSync` |
107+
| Build with Vercel AI SDK's `useChat()` | `@ably/ai-transport/vercel/react` - gives you `useChatTransport()` + `useMessageSync()` |
108108
| Build with Vercel AI SDK using lower-level hooks | `@ably/ai-transport/react` + `@ably/ai-transport/vercel` |
109-
| Build a server endpoint with Vercel AI SDK | `@ably/ai-transport/vercel` - gives you `createServerTransport` pre-bound to `UIMessageCodec` |
109+
| Build a server endpoint with Vercel AI SDK | `@ably/ai-transport/vercel` - gives you `createServerTransport()` pre-bound to `UIMessageCodec` |
110110
| Implement a custom codec for another framework | `@ably/ai-transport` - the generic core with `Codec<TEvent, TMessage>` |

docs/concepts/turns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The client transport tracks all active turns across all clients:
7878
const activeTurns = transport.tree.getActiveTurnIds();
7979
```
8080

81-
In React, `useActiveTurns` provides this as reactive state:
81+
In React, `useActiveTurns()` provides this as reactive state:
8282

8383
```typescript
8484
import { useActiveTurns } from '@ably/ai-transport/react';

docs/features/branching.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const { regenerate } = useView(transport);
3636
await regenerate(nodeId);
3737
```
3838

39-
The transport automatically computes `forkOf` (the assistant message being replaced) and `parent` (the message before it). The server receives these in the POST body and passes them to `newTurn`.
39+
The transport automatically computes `forkOf` (the assistant message being replaced) and `parent` (the message before it). The server receives these in the POST body and passes them to `newTurn()`.
4040

4141
## Edit
4242

@@ -61,7 +61,7 @@ await edit(nodeId, [newMessage]);
6161

6262
## Branch navigation
6363

64-
`useView` provides branch navigation alongside message state:
64+
`useView()` provides branch navigation alongside message state:
6565

6666
```typescript
6767
import { useView } from '@ably/ai-transport/react';
@@ -106,7 +106,7 @@ Calling `select` updates the view's active branch and re-renders with the select
106106

107107
## Server handling
108108

109-
The server receives `forkOf` and `parent` in the POST body. Pass them through to `newTurn`:
109+
The server receives `forkOf` and `parent` in the POST body. Pass them through to `newTurn()`:
110110

111111
```typescript
112112
const { turnId, clientId, forkOf, parent, messages, history } = await req.json();
@@ -130,7 +130,7 @@ The transport stamps `x-ably-parent` and `x-ably-fork-of` headers on the publish
130130

131131
With a single view, navigating to a different branch in one part of the UI changes what every other part sees. Split-pane comparison UIs need independent views so each pane can show a different branch of the same conversation without interfering with the other.
132132

133-
`useCreateView` has the same API as `useView` but creates an independent view instead of using the transport's default. The view is closed automatically when the component unmounts or the transport changes:
133+
`useCreateView()` has the same API as `useView()` but creates an independent view instead of using the transport's default. The view is closed automatically when the component unmounts or the transport changes:
134134

135135
```typescript
136136
import { useClientTransport, useCreateView, useView } from '@ably/ai-transport/react';
@@ -149,7 +149,7 @@ left.select(nodeId, 1);
149149

150150
Both views share the same underlying tree - new messages from the server appear in both. But branch selections, pagination windows, and write operations are scoped to each view.
151151

152-
See [React hooks reference](../reference/react-hooks.md#usecreateview) for the full `useCreateView` API.
152+
See [React hooks reference](../reference/react-hooks.md#usecreateview) for the full `useCreateView()` API.
153153

154154
## Tree from history
155155

docs/features/cancel.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The default when no filter is given is `{ own: true }` - cancel all turns starte
3232
| `{ clientId: "user-2" }` | Cancel all turns started by a specific client | Admin cancelling another user |
3333
| `{ all: true }` | Cancel every active turn on the channel | Emergency stop |
3434

35-
In React, `useActiveTurns` tells you whether turns are active:
35+
In React, `useActiveTurns()` tells you whether turns are active:
3636

3737
```typescript
3838
import { useActiveTurns } from '@ably/ai-transport/react';
@@ -114,4 +114,4 @@ await transport.close({ cancel: { own: true } });
114114
await transport.close();
115115
```
116116

117-
See [Interruption](interruption.md) for cancel-then-send patterns. See [Error codes](../reference/error-codes.md) for cancel-related error codes. See [React hooks reference](../reference/react-hooks.md) for the `useActiveTurns` API. For the internal cancel routing and filter resolution, see [Cancel routing](../internals/transport-components.md#cancel-routing-server-transport).
117+
See [Interruption](interruption.md) for cancel-then-send patterns. See [Error codes](../reference/error-codes.md) for cancel-related error codes. See [React hooks reference](../reference/react-hooks.md) for the `useActiveTurns()` API. For the internal cancel routing and filter resolution, see [Cancel routing](../internals/transport-components.md#cancel-routing-server-transport).

docs/features/history.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The client transport subscribes to the Ably channel **before** attaching. When y
2424

2525
## React hook
2626

27-
`useView` provides message state with integrated history loading:
27+
`useView()` provides message state with integrated history loading:
2828

2929
```typescript
3030
import { useView } from '@ably/ai-transport/react';
@@ -49,7 +49,7 @@ await loadOlder(30);
4949

5050
## Scroll-back pattern
5151

52-
Combine `useView` with a scroll sentinel for infinite scroll:
52+
Combine `useView()` with a scroll sentinel for infinite scroll:
5353

5454
```typescript
5555
const { nodes, hasOlder, loading, loadOlder } = useView(transport, { limit: 30 });
@@ -66,7 +66,7 @@ const { nodes, hasOlder, loading, loadOlder } = useView(transport, { limit: 30 }
6666

6767
History messages carry the same `x-ably-parent` and `x-ably-fork-of` headers as live messages. When loaded, they're inserted into the conversation tree with their full branch structure intact. A client loading history sees the same tree of branches and can navigate siblings just like a client that was present for the original conversation.
6868

69-
Because the tree may contain multiple branches, the view's `flattenNodes()` returns only the messages along the currently selected path - not every message ever published. To see alternative branches, use `useView` or the view's `getSiblings()` / `select()` methods.
69+
Because the tree may contain multiple branches, the view's `flattenNodes()` returns only the messages along the currently selected path - not every message ever published. To see alternative branches, use `useView()` or the view's `getSiblings()` / `select()` methods.
7070

7171
See [Conversation branching](branching.md) for the tree model.
7272

docs/features/interruption.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Both turns produce independent event streams. The message list grows with respon
4949

5050
## Detecting active turns
5151

52-
Use `useActiveTurns` to know whether any turn is streaming:
52+
Use `useActiveTurns()` to know whether any turn is streaming:
5353

5454
```typescript
5555
import { useActiveTurns } from '@ably/ai-transport/react';

docs/features/multi-client.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ This happens for every event - observer messages stream in real time, not just a
3939

4040
## Seeing who's active
4141

42-
`useActiveTurns` tracks all active turns from all clients:
42+
`useActiveTurns()` tracks all active turns from all clients:
4343

4444
```typescript
4545
import { useActiveTurns } from '@ably/ai-transport/react';
@@ -74,7 +74,7 @@ History contains all messages from all clients, with their full branch structure
7474

7575
## Using with useChat
7676

77-
When using the useChat path, `useMessageSync` pushes observer messages into `useChat`'s state:
77+
When using the useChat path, `useMessageSync()` pushes observer messages into `useChat()`'s state:
7878

7979
```typescript
8080
import { useMessageSync } from '@ably/ai-transport/vercel/react';
@@ -85,7 +85,7 @@ useMessageSync(transport, setMessages);
8585
// messages now includes messages from all clients on the channel
8686
```
8787

88-
Without `useMessageSync`, `useChat` would only show messages from its own sends. The sync hook replaces `useChat`'s message state with the transport's authoritative list on every update.
88+
Without `useMessageSync()`, `useChat()` would only show messages from its own sends. The sync hook replaces `useChat()`'s message state with the transport's authoritative list on every update.
8989

9090
## Identity
9191

docs/features/optimistic-updates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ const turn = await view.send([questionOne, questionTwo]);
7878

7979
**Multi-client ordering** - in a conversation with multiple clients sending concurrently, optimistic messages appear at the end of the local tree until reconciliation. After reconciliation, the serial determines the canonical order, which may differ from the optimistic insertion order. All clients converge on the same order once relays are reconciled.
8080

81-
**Cleanup** - the transport tracks optimistic msg-ids per turn. When a [turn](../concepts/turns.md) ends (via `x-ably-turn-end` on the channel), the tracking state for that turn is cleaned up. This prevents stale msg-ids from matching against unrelated messages in future turns.
81+
**Cleanup** - the transport tracks optimistic message IDs per turn. When a [turn](../concepts/turns.md) ends (via `x-ably-turn-end` on the channel), the tracking state for that turn is cleaned up. This prevents stale message IDs from matching against unrelated messages in future turns.
8282

8383
For the internal implementation details, see [Client transport: optimistic reconciliation](../internals/client-transport.md#optimistic-reconciliation), [Conversation tree: upsert](../internals/conversation-tree.md#upsert-the-sole-mutation), and [Wire protocol: message identity](../internals/wire-protocol.md#message-identity-x-ably-msg-id).

docs/features/streaming.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Each stream has a lifecycle tracked by the `x-ably-status` header:
3636

3737
## Server
3838

39-
Pipe any `ReadableStream` of codec events through the turn's `streamResponse`:
39+
Pipe any `ReadableStream` of codec events through the turn's `streamResponse()`:
4040

4141
```typescript
4242
import { streamText } from 'ai';
@@ -57,7 +57,7 @@ await turn.end(reason);
5757
transport.close();
5858
```
5959

60-
`streamResponse` reads events from the stream and routes them through the encoder. Text deltas become message appends; lifecycle events (finish, error) become discrete messages that close the stream.
60+
`streamResponse()` reads events from the stream and routes them through the encoder. Text deltas become message appends; lifecycle events (finish, error) become discrete messages that close the stream.
6161

6262
## Client
6363

@@ -78,7 +78,7 @@ This is the primary consumption path. In React, the `useView()` hook handles the
7878

7979
### The event stream
8080

81-
`send()` also returns a `ReadableStream<TEvent>` on the `ActiveTurn`. This exists as an integration seam for framework adapters - Vercel's `useChat` expects a `ReadableStream` as its transport contract. Most application code should use the view instead, since the accumulator provides the same per-token granularity.
81+
`send()` also returns a `ReadableStream<TEvent>` on the `ActiveTurn`. This exists as an integration seam for framework adapters - Vercel's `useChat()` expects a `ReadableStream` as its transport contract. Most application code should use the view instead, since the accumulator provides the same per-token granularity.
8282

8383
```typescript
8484
// Framework adapter usage - most apps won't consume this directly
@@ -112,4 +112,4 @@ The transport streams whatever events the codec produces. For the Vercel AI SDK
112112

113113
Multiple content streams can be active within a single turn (e.g., reasoning + text). Each gets its own message with its own stream ID.
114114

115-
See [Tool calling](tool-calling.md) for how tool input deltas and results are streamed. See [React hooks reference](../reference/react-hooks.md) for the full `useView` and `useClientTransport` API. See [Cancel](cancel.md) for how streams are aborted. For the internal mechanics of message encoding, decoding, and recovery, see the [Encoder](../internals/encoder.md), [Decoder](../internals/decoder.md), and [Wire protocol](../internals/wire-protocol.md) internals pages.
115+
See [Tool calling](tool-calling.md) for how tool input deltas and results are streamed. See [React hooks reference](../reference/react-hooks.md) for the full `useView()` and `useClientTransport()` API. See [Cancel](cancel.md) for how streams are aborted. For the internal mechanics of message encoding, decoding, and recovery, see the [Encoder](../internals/encoder.md), [Decoder](../internals/decoder.md), and [Wire protocol](../internals/wire-protocol.md) internals pages.

docs/frameworks/vercel-ai-sdk.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Vercel AI SDK
22

3-
The Vercel AI SDK provides model abstraction, streaming primitives, and React hooks (`useChat`) for building AI applications. AI Transport adds a durable real-time layer underneath - streaming over Ably channels instead of direct HTTP, with persistence, multi-client sync, and cancellation built in.
3+
The Vercel AI SDK provides model abstraction, streaming primitives, and React hooks (`useChat()`) for building AI applications. AI Transport adds a durable real-time layer underneath - streaming over Ably channels instead of direct HTTP, with persistence, multi-client sync, and cancellation built in.
44

55
## What AI Transport adds
66

@@ -17,7 +17,7 @@ The Vercel AI SDK provides model abstraction, streaming primitives, and React ho
1717

1818
### useChat path (simpler)
1919

20-
Wrap the transport in a `ChatTransport` adapter and pass it to Vercel's `useChat`. Message state is managed by `useChat` - the transport delivers messages over Ably instead of HTTP.
20+
Wrap the transport in a `ChatTransport` adapter and pass it to Vercel's `useChat()`. Message state is managed by `useChat()` - the transport delivers messages over Ably instead of HTTP.
2121

2222
```typescript
2323
import { useClientTransport } from '@ably/ai-transport/react';
@@ -37,11 +37,11 @@ const { messages, setMessages, sendMessage, stop } = useChat({
3737
useMessageSync(transport, setMessages);
3838
```
3939

40-
`useChatTransport` wraps the core transport into the `ChatTransport` interface that `useChat` expects. `useMessageSync` pushes the transport's authoritative message list into `useChat`'s state - this is how messages from other clients appear.
40+
`useChatTransport()` wraps the core transport into the `ChatTransport` interface that `useChat()` expects. `useMessageSync()` pushes the transport's authoritative message list into `useChat()`'s state - this is how messages from other clients appear.
4141

4242
### Generic hooks path (more control)
4343

44-
Use the generic React hooks directly. You manage message state through the transport's conversation tree instead of `useChat`.
44+
Use the generic React hooks directly. You manage message state through the transport's conversation tree instead of `useChat()`.
4545

4646
```typescript
4747
import {
@@ -63,23 +63,23 @@ This path gives you conversation branching UI (sibling navigation), write operat
6363
| Use useChat when... | Use generic hooks when... |
6464
|---|---|
6565
| You want the simplest integration | You need conversation branching UI |
66-
| `useChat`'s message state management is sufficient | You need custom message construction |
66+
| `useChat()`'s message state management is sufficient | You need custom message construction |
6767
| You don't need edit or branch navigation | You need `edit()` or `view.select()` |
68-
| You're already using `useChat` and adding AI Transport | You're building a custom chat UI from scratch |
68+
| You're already using `useChat()` and adding AI Transport | You're building a custom chat UI from scratch |
6969

7070
## Entry points
7171

7272
| Import | What you get |
7373
|---|---|
74-
| `@ably/ai-transport/vercel` | `UIMessageCodec`, `createServerTransport`, `createClientTransport`, `createChatTransport` - all pre-bound to Vercel types |
75-
| `@ably/ai-transport/vercel/react` | `useChatTransport`, `useMessageSync` - hooks for the useChat path |
74+
| `@ably/ai-transport/vercel` | `UIMessageCodec`, `createServerTransport()`, `createClientTransport()`, `createChatTransport()` - all pre-bound to Vercel types |
75+
| `@ably/ai-transport/vercel/react` | `useChatTransport()`, `useMessageSync()` - hooks for the useChat path |
7676
| `@ably/ai-transport/react` | Generic hooks - work with any codec including `UIMessageCodec` |
7777

78-
The Vercel entry points are convenience wrappers. `createServerTransport` from `/vercel` is the same as the core `createServerTransport` with `UIMessageCodec` pre-bound - you don't pass a `codec` option.
78+
The Vercel entry points are convenience wrappers. `createServerTransport()` from `/vercel` is the same as the core `createServerTransport()` with `UIMessageCodec` pre-bound - you don't pass a `codec` option.
7979

8080
## Server side
8181

82-
The server code is the same for both client paths. Use `createServerTransport` from the Vercel entry point and pipe `streamText`'s output through a turn:
82+
The server code is the same for both client paths. Use `createServerTransport()` from the Vercel entry point and pipe `streamText()`'s output through a turn:
8383

8484
```typescript
8585
import { createServerTransport } from '@ably/ai-transport/vercel';

0 commit comments

Comments
 (0)