Skip to content

Feature/ait 1090 ait release 0 4 0#3454

Merged
zknill merged 15 commits into
mainfrom
feature/AIT-1090-ait-release-0-4-0
Jul 2, 2026
Merged

Feature/ait 1090 ait release 0 4 0#3454
zknill merged 15 commits into
mainfrom
feature/AIT-1090-ait-release-0-4-0

Conversation

@mschristensen

@mschristensen mschristensen commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Aligns the AI Transport docs with @ably/ai-transport v0.4.0 (the changes merged to the SDK's main since 0.3.0). v0.4.0 reworks the run read-model and how an agent rebuilds conversation history, so this is largely a breaking-API sweep plus two net-new pages.

Gated on release. v0.4.0 is not on npm yet (main is untagged, package.json still 0.3.0). Code samples were written against the SDK's origin/main type declarations and cross-checked against the SDK's own in-repo docs/. Re-verify against the published package and the final CHANGELOG before merge.

Base branch is skills/docs-authoring-orchestrator (where the docs-authoring skills that produced this work live), not main.

The headline change: agents drain run.view instead of loadConversation

Run.loadConversation() is gone. An agent now rebuilds the model context by draining its leaf-pinned run.view — and it must do so before run.start():

// before (0.3.0)
await run.start();
await run.loadConversation();
const result = streamText({ messages: run.messages, ... });

// after (0.4.0)
while (run.view.hasOlder()) {   // folds the triggering input into the tree
  await run.view.loadOlder();
}
const conversation = run.view.getMessages().map(({ message }) => message);
await run.start();              // awaits run.located — now already located
const result = streamText({ messages: conversation, ... });

Ordering matters: run.start() awaits run.located, and on a cold start (agent attaches after the client published) the triggering input only folds into the tree once the caller pages run.view. Draining after start() can hang with no timeout. Database-backed hydration uses the same shape with run.view.loadUntil(seam) instead of a full drain.

run.messages no longer means "the whole conversation" — it's now this run's own turn (its triggering input + streamed output), the unit you persist.

Breaking changes swept through the docs

  • ActiveRunClientRun; Run (agent) → AgentRun; both extend a shared BaseRun (runId, status, error, messages).
  • ClientRun.runId is now synchronous (empty until run-start); await the new ClientRun.started, then read it. (await run.runIdawait run.started; run.runId.)
  • View split into a read base View + writable ClientView; View.selectSibling(id, i)view.branchSelection(id).select(i) (BranchSelectionBranchHandle).
  • View.loadOlder() now resolves to the revealed page (was Promise<void>); new View.loadUntil().
  • ClientSessionOptions.messages seed removed; new historyPageSize.
  • Agent errors unified on AgentSession.on('error') (removed AgentSessionOptions.onError); removed inputEventLookupTimeoutMs / inputEventLookbackMs / inputEventBufferLimit / rewindWindow — replaced by the passive input-event watcher and AgentRun.located.
  • Error code 104010 InputEventNotFound removed.
  • Already-removed-at-0.3.0 surfaces the docs still documented, now gone: Run.addEvents / EventsNode, loadProjection, RunView, MessageNode.

New pages

  • features/database-hydration.mdx — the seam-reconciliation model (View.loadUntil + useMessagesWithSeed) that replaces the removed seed option: persist completed runs, reconcile stored history with the live channel on reload.
  • api/react/core/use-messages-with-seed.mdx — the new hook.

Both are registered in the nav and API hub.

For reviewers

  • Code accuracy is the main risk since the SDK is unreleased. Verified against the SDK's origin/main .d.ts, its in-repo docs, and the use-chat-db demo. A full docs-review-all pass (all five concerns) is green; the notable catch was the drain-before-start() ordering above.
  • Pages verified as already-correct were deliberately left untouched (use-client-session, reconnection-and-recovery, optimistic-updates, human-in-the-loop, authentication).
  • Known follow-ups: features/database-hydration.mdx ships prose-only (a flow diagram is a design follow-up); a pre-existing run.end(reason) positional call on the unchanged features/cancellation.mdx was left out of scope.

Relates to AIT-1090.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3c533aba-84b3-4753-8b9d-7604df35b369

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/AIT-1090-ait-release-0-4-0

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mschristensen mschristensen changed the base branch from main to skills/docs-authoring-orchestrator July 1, 2026 07:09
@mschristensen mschristensen added the review-app Create a Heroku review app label Jul 1, 2026
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 07:10 Inactive
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 07:27 Inactive
Comment thread src/pages/docs/ai-transport/api/javascript/core/agent-session.mdx Outdated
Comment thread src/pages/docs/ai-transport/api/javascript/core/agent-session.mdx Outdated
Comment thread src/pages/docs/ai-transport/api/javascript/core/agent-session.mdx Outdated
Comment thread src/pages/docs/ai-transport/api/javascript/core/agent-session.mdx Outdated
Comment thread src/pages/docs/ai-transport/api/javascript/core/agent-session.mdx Outdated
Comment thread src/pages/docs/ai-transport/api/javascript/core/agent-session.mdx Outdated
Comment thread src/pages/docs/ai-transport/api/javascript/core/agent-session.mdx Outdated
Comment thread src/pages/docs/ai-transport/api/javascript/vercel/run-outcome.mdx Outdated
Comment thread src/pages/docs/ai-transport/features/database-hydration.mdx Outdated
Comment thread src/pages/docs/ai-transport/features/database-hydration.mdx Outdated
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 09:32 Inactive
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from 5501041 to 5642380 Compare July 1, 2026 14:55
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 14:56 Inactive
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from 5642380 to 9d1030e Compare July 1, 2026 15:05
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 15:06 Inactive
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from 9d1030e to 861643d Compare July 1, 2026 15:56
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 15:57 Inactive
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from 861643d to 5c6737f Compare July 1, 2026 16:21
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 16:21 Inactive
Target the upcoming @ably/ai-transport v0.4.0 release across the AI
Transport docs. The version registry drives both the page version badge
and the code-accuracy baseline, so the samples updated in this PR align
with the v0.4.0 surface.

AIT-1090
@mschristensen mschristensen changed the base branch from skills/docs-authoring-orchestrator to main July 1, 2026 16:30
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from 5c6737f to 1ef2fab Compare July 1, 2026 16:30
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 16:31 Inactive
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from 1ef2fab to f333de2 Compare July 1, 2026 16:45
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 16:45 Inactive
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from f333de2 to a566726 Compare July 1, 2026 16:46
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 16:47 Inactive
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from a566726 to 3025171 Compare July 1, 2026 16:48
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 16:49 Inactive
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from 3025171 to 23e9ad2 Compare July 1, 2026 16:49
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 16:50 Inactive
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from 23e9ad2 to 4e5b1bf Compare July 1, 2026 16:54
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 16:54 Inactive
v0.4.0 replaces the removed ClientSessionOptions.messages seed with a
seam-reconciliation model: View.loadUntil pages the channel back to the
newest stored message and returns the not-yet-stored tail, and the new
useMessagesWithSeed React hook composes a persisted seed with the live
view.

- Add features/database-hydration.mdx covering the seam model, agent and
  client hydration, turn persistence (run.messages), and edge cases.
- Add api/react/core/use-messages-with-seed.mdx for the new hook.
- Register both pages in the AI Transport nav and the API reference hub.

AIT-1090
Update the concept tier for the v0.4.0 run read-model and the input-event
watcher that replaces the history-scan lookup.

- runs.mdx: ActiveRun -> ClientRun; runId is now synchronous (empty until
  run-start), awaited via the new `started`; add a "Read a Run from either
  side" section for the shared BaseRun read-model (runId/status/error/
  messages) and the per-side verbs; the agent rehydrates by draining
  run.view rather than loadConversation; note one input per send.
- invocations.mdx: ClientRun naming; AgentRun.start awaits the input-event
  watcher (live or channel history) instead of a rewind+live lookup.
- connections.mdx: branch navigation via branchSelection().select.

AIT-1090
client-session.mdx:
- View -> ClientView surface; branchSelection().select replaces
  selectSibling; loadOlder now resolves to the revealed page and loadUntil
  is documented; send/regenerate/edit return ClientRun and take one new
  message per send.
- Drop the removed ClientSessionOptions.messages seed; add historyPageSize.
- ActiveRun -> ClientRun; runId is synchronous (empty until run-start),
  awaited via started.

agent-session.mdx:
- Run -> AgentRun extending BaseRun (runId/status/error/messages); add the
  leaf-pinned run.view and located; rewrite start() around the input-event
  watcher (no more inputEventLookupTimeoutMs / InputEventNotFound 104010).
- Remove the already-removed addEvents/EventsNode, loadProjection, and
  loadConversation/LoadConversationOptions surfaces; rewrite conversation
  hydration to drain run.view.
- Replace the onError option with on('error'); historyPageSize replaces the
  input-event lookup/buffer/rewind options; close() is async.

AIT-1090
v0.4.0 removes ErrorCode.InputEventNotFound (104010): the input-event
watcher replaces the timed history-scan lookup, so there is no lookup
timeout to fail. Remove the 104010 row, and document non-fatal session
errors as delivered through session.on('error') on both the client and the
agent, replacing the removed AgentSessionOptions.onError option.

AIT-1090
- use-view.mdx / use-create-view.mdx: ViewHandle.loadOlder now resolves to
  the revealed page; branchSelection returns a BranchHandle whose select()
  replaces the removed selectSibling; send/regenerate/edit return ClientRun
  and take one new message per send; View -> ClientView; pagination counts
  codecMessages.
- providers.mdx: drop the removed ClientSessionOptions.messages seed prop;
  document channelModes and historyPageSize.

use-client-session.mdx is unchanged: its hook source did not change in
v0.4.0 and it already documents session.on('error').

AIT-1090
- chat-transport.mdx: drop the removed messages seed from the client
  options and the removed onError / inputEventLookupTimeoutMs /
  inputEventBufferLimit / rewindWindow from the agent options; add
  historyPageSize and channelModes; point session errors at on('error').
- chat-transport-provider.mdx: drop the removed messages seed prop; add
  historyPageSize.
- use-message-sync.mdx: document the new messages seed option that
  reconciles a useChat seed with the live channel.
- run-outcome.mdx: rebuild the model context by draining run.view instead
  of the removed loadConversation; await the now-async session.close().

AIT-1090
v0.4.0 removes Run.loadConversation; the agent rebuilds model context by
draining its leaf-pinned run.view. Replace the loadConversation call inline
across the agent-route examples (concurrent-turns, chain-of-thought,
agent-presence, token-streaming, push-notifications, branching), feeding the
drained run.view.getMessages() to the model.

Also on these pages: ActiveRun -> ClientRun with synchronous runId awaited
via started (concurrent-turns), and branch navigation via the
branchSelection handle's select() rather than the removed selectSibling
(branching).

AIT-1090
- history.mdx: loadOlder now resolves to the revealed page (drop the
  Promise<void> claim and the FAQ that defended it); note historyPageSize;
  cross-link database hydration for longer-than-retention storage.
- multi-device.mdx: ActiveRun -> ClientRun (runId populated after started);
  link database hydration.
- interruption.mdx: ActiveRun -> ClientRun.

reconnection-and-recovery, optimistic-updates, and human-in-the-loop
already match v0.4.0 (they use session.on('error') and wire-only
tool-approval-response inputs), so they are unchanged.

AIT-1090
- vercel-ai-sdk-core.mdx: rebuild the model context by draining run.view
  instead of the removed loadConversation; await the now-async
  session.close().
- vercel-ai-sdk-ui.mdx: note that useMessageSync's messages seed reconciles
  a database-loaded conversation with the live channel.

AIT-1090
- core-sdk.mdx / vercel-ai-sdk.mdx: rebuild the model context by draining
  run.view instead of the removed loadConversation; view.send returns a
  ClientRun (toInvocation via clientRun).
- core-sdk.mdx: drop selectSibling from the useView surface list and the
  branching pointer in favour of the branchSelection handle's select;
  ClientView naming.

authentication.mdx is unchanged: it only uses useClientSession, which did
not change in v0.4.0.

AIT-1090
- transport-patterns.mdx: replace the input-event lookup section (rewind +
  inputEventLookupTimeoutMs + inputEventBufferLimit + InputEventNotFound)
  with the input-event watcher armed by createRun and awaited via
  run.located; ActiveRun -> ClientRun with started.
- wire-protocol.mdx: AgentRun.start awaits run.located (no rewindWindow /
  lookup timeout / InputEventNotFound); ActiveRun.runId -> clientRun.runId
  populated after started.
- conversation-tree.mdx: branch navigation via the branchSelection handle's
  select (BranchSelection -> BranchHandle); ClientRun naming.

AIT-1090
Run.addEvents and the EventsNode type were removed from the public API. A
late tool result is delivered as a tool-result input addressed to the
original message on a continuation (the pattern already shown above on the
page), not via a cross-run addEvents call. Drop the obsolete section and fix
the edge-case bullet that referenced it.

AIT-1090
Link integrity:
- errors.mdx: Ably error codes link -> /docs/platform/errors/codes.
- chain-of-thought.mdx: codec link -> api/javascript/core/codec.
- vercel-ai-sdk-ui.mdx: Vercel API link -> the chat-transport page.
- repoint the anchorless client-session#view links to #properties
  (connections, invocations, runs, core-sdk, client-session).
- troubleshooting.mdx: branching#branch-navigation -> #navigate.
- run-outcome.mdx: reference the VercelRunOutcome table inline so it renders.

Code accuracy (SendOptions is { forkOf, parent, runId } only):
- use-view.mdx: remove the fabricated SendOptions.inputEventId row.
- invocations.mdx: drop the false "override inputEventId/codecMessageId via
  SendOptions" claim.
- transport-patterns.mdx / troubleshooting.mdx: run.end takes a RunEndParams
  object, so run.end({ reason }), not the positional run.end(reason).

AIT-1090
run.start() awaits run.located, and on a cold start the triggering input
only folds into the tree once the caller pages run.view — so draining after
start() can hang. Reorder every agent example to drain (loadOlder loop) and
build the conversation before calling run.start(), matching the SDK's own
v0.4.0 docs (streaming.md, database-hydration.md) and the AgentRun.start
contract. Affects agent-session, run-outcome, the agent-route feature pages,
both frameworks pages, and both getting-started guides. database-hydration
already used the correct loadUntil-then-start order.

Also: chain-of-thought used "turn" for the Run lifecycle unit (abort signal,
stream multiplexing, post-completion) inconsistently with the rest of the
page — align to "Run". Fix "client-side React hooks" casing on the Vercel
AI SDK UI page.

AIT-1090
@mschristensen mschristensen force-pushed the feature/AIT-1090-ait-release-0-4-0 branch from 4e5b1bf to ce248e5 Compare July 1, 2026 17:37
@ably-ci ably-ci temporarily deployed to ably-docs-feature-ait-1-b4ysi1 July 1, 2026 17:38 Inactive
@mschristensen mschristensen requested a review from zknill July 1, 2026 17:38
@mschristensen mschristensen marked this pull request as ready for review July 1, 2026 17:38
@zknill zknill merged commit 650eb86 into main Jul 2, 2026
7 checks passed
@zknill zknill deleted the feature/AIT-1090-ait-release-0-4-0 branch July 2, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-app Create a Heroku review app

Development

Successfully merging this pull request may close these issues.

3 participants