Skip to content

docs: rewrite all hand-written docs for action-first clarity - #1056

Draft
tombeckenham wants to merge 3 commits into
mainfrom
task/simplify-docs
Draft

docs: rewrite all hand-written docs for action-first clarity#1056
tombeckenham wants to merge 3 commits into
mainfrom
task/simplify-docs

Conversation

@tombeckenham

@tombeckenham tombeckenham commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Rewrites every hand-written docs page for action-first clarity.

What changed

  • 141 pages rewritten — ~7.3k lines in, ~19.2k lines out (net −12k). The cut is preamble, marketing framing, and restated concepts, not content.
  • Lead with the action. Each page opens with "if you need X, do Y" rather than a paragraph explaining what the feature is before showing it.
  • Numbered steps and code first. Setup flows are steps you can follow top to bottom; explanation follows the snippet instead of preceding it.
  • docs/config.jsonupdatedAt refreshed on the 140 touched entries per the docs convention.

Auto-generated reference docs (TypeDoc output) are untouched.

Notes

Docs-only — no source, no behavior change, so no changeset and no E2E additions. Worth a skim of a few pages you know well to check the compression didn't drop something load-bearing.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Reorganized and condensed documentation across adapters, APIs, chat, tools, media, persistence, sandboxes, migrations, and advanced topics.
    • Added clearer quick-start instructions, configuration tables, capability references, troubleshooting guidance, and updated examples.
    • Clarified current behavior for streaming, resumability, persistence, approvals, structured outputs, tools, media generation, and sandbox workflows.
    • Updated documentation navigation metadata and refreshed links, terminology, and migration guidance.

Cut ~12k lines of preamble and marketing across 141 pages. Lead with
"if you need X, do Y", numbered steps, and code-first guidance. Leave
auto-generated reference docs alone.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 419d12fa-50b6-440b-b1d2-fe35cff718de

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
📝 Walkthrough

Walkthrough

Changes

Documentation consolidation

Layer / File(s) Summary
Adapter documentation
docs/adapters/*, docs/community-adapters/*
Adapter guides were shortened and reorganized around installation, authentication, usage, configuration, capabilities, tools, models, and next steps.
Core API and advanced guides
docs/api/*, docs/advanced/*
API, middleware, multimodal, runtime, observability, and type-safety guidance was condensed and updated.
Chat, media, tools, and sandbox guides
docs/chat/*, docs/media/*, docs/tools/*, docs/sandbox/*, docs/code-mode/*
Current streaming, generation, tool, MCP, Code Mode, and sandbox flows were documented with shorter examples and tables.
Persistence, interrupts, and migrations
docs/persistence/*, docs/interrupts/*, docs/migration/*, docs/resumable-streams/*
Contracts, lifecycle behavior, migration steps, durability, resume handling, and validation rules were reorganized.
Navigation and onboarding
docs/config.json, docs/getting-started/*, docs/comparison/*
Navigation dates, quick starts, onboarding content, and comparison guidance were updated.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested reviewers: alemtuzlak

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary documentation rewrite and its action-first clarity goal.
Description check ✅ Passed The description clearly explains the scope, rationale, documentation-only impact, line changes, and release implications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/simplify-docs

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.

@nx-cloud

nx-cloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 6613175

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 21s View ↗
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 3s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-07 00:34:26 UTC

@pkg-pr-new

pkg-pr-new Bot commented Aug 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/@tanstack/ai@1056

@tanstack/ai-acp

npm i https://pkg.pr.new/@tanstack/ai-acp@1056

@tanstack/ai-angular

npm i https://pkg.pr.new/@tanstack/ai-angular@1056

@tanstack/ai-anthropic

npm i https://pkg.pr.new/@tanstack/ai-anthropic@1056

@tanstack/ai-bedrock

npm i https://pkg.pr.new/@tanstack/ai-bedrock@1056

@tanstack/ai-byteplus

npm i https://pkg.pr.new/@tanstack/ai-byteplus@1056

@tanstack/ai-claude-code

npm i https://pkg.pr.new/@tanstack/ai-claude-code@1056

@tanstack/ai-client

npm i https://pkg.pr.new/@tanstack/ai-client@1056

@tanstack/ai-code-mode

npm i https://pkg.pr.new/@tanstack/ai-code-mode@1056

@tanstack/ai-code-mode-skills

npm i https://pkg.pr.new/@tanstack/ai-code-mode-skills@1056

@tanstack/ai-codex

npm i https://pkg.pr.new/@tanstack/ai-codex@1056

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/@tanstack/ai-devtools-core@1056

@tanstack/ai-durable-stream

npm i https://pkg.pr.new/@tanstack/ai-durable-stream@1056

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@1056

@tanstack/ai-event-client

npm i https://pkg.pr.new/@tanstack/ai-event-client@1056

@tanstack/ai-fal

npm i https://pkg.pr.new/@tanstack/ai-fal@1056

@tanstack/ai-gemini

npm i https://pkg.pr.new/@tanstack/ai-gemini@1056

@tanstack/ai-grok

npm i https://pkg.pr.new/@tanstack/ai-grok@1056

@tanstack/ai-grok-build

npm i https://pkg.pr.new/@tanstack/ai-grok-build@1056

@tanstack/ai-groq

npm i https://pkg.pr.new/@tanstack/ai-groq@1056

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@1056

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/@tanstack/ai-isolate-node@1056

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@1056

@tanstack/ai-mcp

npm i https://pkg.pr.new/@tanstack/ai-mcp@1056

@tanstack/ai-memory

npm i https://pkg.pr.new/@tanstack/ai-memory@1056

@tanstack/ai-mistral

npm i https://pkg.pr.new/@tanstack/ai-mistral@1056

@tanstack/ai-ollama

npm i https://pkg.pr.new/@tanstack/ai-ollama@1056

@tanstack/ai-openai

npm i https://pkg.pr.new/@tanstack/ai-openai@1056

@tanstack/ai-opencode

npm i https://pkg.pr.new/@tanstack/ai-opencode@1056

@tanstack/ai-openrouter

npm i https://pkg.pr.new/@tanstack/ai-openrouter@1056

@tanstack/ai-persistence

npm i https://pkg.pr.new/@tanstack/ai-persistence@1056

@tanstack/ai-preact

npm i https://pkg.pr.new/@tanstack/ai-preact@1056

@tanstack/ai-react

npm i https://pkg.pr.new/@tanstack/ai-react@1056

@tanstack/ai-react-ui

npm i https://pkg.pr.new/@tanstack/ai-react-ui@1056

@tanstack/ai-sandbox

npm i https://pkg.pr.new/@tanstack/ai-sandbox@1056

@tanstack/ai-sandbox-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-sandbox-cloudflare@1056

@tanstack/ai-sandbox-daytona

npm i https://pkg.pr.new/@tanstack/ai-sandbox-daytona@1056

@tanstack/ai-sandbox-docker

npm i https://pkg.pr.new/@tanstack/ai-sandbox-docker@1056

@tanstack/ai-sandbox-local-process

npm i https://pkg.pr.new/@tanstack/ai-sandbox-local-process@1056

@tanstack/ai-sandbox-sprites

npm i https://pkg.pr.new/@tanstack/ai-sandbox-sprites@1056

@tanstack/ai-sandbox-vercel

npm i https://pkg.pr.new/@tanstack/ai-sandbox-vercel@1056

@tanstack/ai-solid

npm i https://pkg.pr.new/@tanstack/ai-solid@1056

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/@tanstack/ai-solid-ui@1056

@tanstack/ai-svelte

npm i https://pkg.pr.new/@tanstack/ai-svelte@1056

@tanstack/ai-utils

npm i https://pkg.pr.new/@tanstack/ai-utils@1056

@tanstack/ai-vue

npm i https://pkg.pr.new/@tanstack/ai-vue@1056

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/@tanstack/ai-vue-ui@1056

@tanstack/openai-base

npm i https://pkg.pr.new/@tanstack/openai-base@1056

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@1056

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/@tanstack/react-ai-devtools@1056

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@1056

commit: 6613175

The ADHD rewrite left fragment fences without imports/groups. Complete
snippets, re-add group/ignore tags, and fix enums so kiira check passes.
@tombeckenham
tombeckenham marked this pull request as ready for review August 6, 2026 08:44
@tombeckenham
tombeckenham marked this pull request as draft August 6, 2026 08:45

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Due to the large number of review comments, Critical severity comments were prioritized as inline comments.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (19)
docs/adapters/gemini.md (1)

321-334: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use supported SDK enum values in the Imagen safety example.

personGeneration: "DONT_ALLOW" is valid, but safetyFilterLevel: "BLOCK_SOME" is not a supported SafetyFilterLevel value. Replace it with a supported string such as BLOCK_LOW_AND_ABOVE, BLOCK_MEDIUM_AND_ABOVE, BLOCK_NONE, or BLOCK_ONLY_HIGH so the // SafetyFilterLevel enum note matches the API.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adapters/gemini.md` around lines 321 - 334, Update the safetyFilterLevel
value in the geminiImage Imagen example to a supported SafetyFilterLevel string,
such as BLOCK_LOW_AND_ABOVE, while preserving the existing personGeneration
example and enum note.
docs/advanced/multimodal-content.md (2)

241-250: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Require mimeType for data sources in ContentPartSchema.

ContentPartSchema accepts image sources with only type and value, so invalid data-source messages can pass validation before chat() rejects them. Use separate data and url source schemas so mimeType is required only for the data branch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/advanced/multimodal-content.md` around lines 241 - 250, Update
ContentPartSchema’s image source validation to use separate discriminated
branches for data and URL sources. Require a string mimeType on the data branch
while keeping URL sources valid with only their existing type and value fields.

417-424: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Handle upload failures at the input boundary.

handleFileUpload rejects on FileReader failure, but void handleFileUpload(file) has no rejection handler. Catch the promise and show an upload error so read failures do not become unhandled promise rejections without user feedback.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/advanced/multimodal-content.md` around lines 417 - 424, Update the file
input’s onChange handler to attach rejection handling when invoking
handleFileUpload, displaying an upload error to the user if the promise rejects.
Preserve the existing file selection and successful upload flow while ensuring
FileReader failures are not left as unhandled rejections.
docs/chat/connection-adapters.md (2)

411-424: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Parse the final NDJSON record.

The loop only parses lines that end with \n. It never flushes TextDecoder or parses the residual buffer after done. A final RUN_FINISHED or data chunk without a trailing newline is dropped.

Proposed fix
-      if (done) break
+      if (done) {
+        buffer += decoder.decode()
+        if (buffer.trim()) {
+          yield JSON.parse(buffer)
+        }
+        break
+      }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/chat/connection-adapters.md` around lines 411 - 424, The stream parser
must flush the TextDecoder and parse any non-empty residual buffer after
reader.read() reports done. Update the async generator around reader.read(),
decoder.decode(), and the line-processing loop so a final NDJSON record without
a trailing newline, including RUN_FINISHED or data chunks, is yielded before
completion.

328-338: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Honor send’s abort signal.

send receives abortSignal but awaits the socket open promise unconditionally, so stop() can still complete the send after cancellation. Make the readiness wait interruptible and check abortSignal.aborted before ws.send.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/chat/connection-adapters.md` around lines 328 - 338, Update send to use
its _abortSignal when awaiting ready, allowing cancellation to interrupt the
readiness wait, and check _abortSignal.aborted immediately before ws.send.
Preserve the existing payload and send behavior when the signal is not aborted.
docs/api/ai-angular.md (1)

460-481: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Move inject(Injector) inside a valid injection context.

Line 463 calls inject(Injector) at module scope, where Angular has no injection context. Use the injector from a field initializer or constructor, then pass that instance into runInInjectionContext.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/api/ai-angular.md` around lines 460 - 481, Move the module-scope
injector lookup into a valid Angular injection context, such as a field
initializer or constructor on MyComponent/MyComponentAlt, then pass that
injector instance to runInInjectionContext. Remove the top-level
inject(Injector) call while preserving the existing injectChat example.
docs/sandbox/durability.md (1)

35-35: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Mark the in-memory example as local-only.

The page requires durable stores and distributed locks for multi-replica deployments, but the primary example instantiates InMemorySandboxInstanceStore and InMemoryLockStore without a local-development warning. Two replicas can then create separate sandboxes for the same key. Label this example as local-only and show the production store replacements.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/sandbox/durability.md` at line 35, Update the durability documentation
example around InMemorySandboxInstanceStore and InMemoryLockStore to clearly
label the in-memory configuration as local-development-only. Add the
corresponding production store replacements so multi-replica deployments use
durable instance storage and distributed locking.
docs/adapters/elevenlabs.md (1)

143-173: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Call useRealtimeChat from a component or custom hook.

The client-tools example invokes useRealtimeChat(...) at module scope. React hooks cannot run outside components or custom hooks. Move this setup inside a component/custom hook, or separate the client tool definition from the hooked chat instance.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adapters/elevenlabs.md` around lines 143 - 173, Move the useRealtimeChat
invocation into a React component or custom hook, while keeping the
getWeatherDef and getWeather client-tool definitions reusable at module scope.
Ensure the chat setup still passes the elevenlabsRealtime adapter and getWeather
tool without invoking the hook during module initialization.
docs/advanced/locks.md (2)

137-145: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep the per-thread work under the lock.

withLock releases ownership when the callback resolves. The callback here only does void signal, so the lock is released before the actual per-thread operation runs. Two requests for the same thread can enter concurrently. Move the protected operation inside the callback, or use a lifecycle hook that spans the run.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/advanced/locks.md` around lines 137 - 145, The serializePerThread
middleware currently releases the lock immediately because its withLock callback
only evaluates signal. Move the actual per-thread operation into the callback,
or replace this with a lifecycle hook that keeps the lock held for the full run,
ensuring requests sharing ctx.threadId remain serialized.

45-52: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the current OpenAI model in the OpenAI examples.

docs/tools/provider-skills.md#L105 and docs/tools/provider-skills.md#L136 use gpt-5.2, but the OpenAI model metadata contains newer gpt-5.5, gpt-5.5-pro, and related IDs. Use the newest compatible OpenAI model ID there.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/advanced/locks.md` around lines 45 - 52, Update the OpenAI model
identifiers in the examples to the newest compatible ID from the current OpenAI
model metadata, replacing outdated gpt-5.2 references while preserving each
example’s existing provider setup: docs/advanced/locks.md:45-52;
docs/tools/provider-skills.md:49-56, 105-113;
docs/advanced/typed-options.md:30-34, 85-91, 133-138;
docs/adapters/elevenlabs.md:232-237, 248-256;
docs/sandbox/durable-runs.md:41-43; docs/sandbox/durability.md:64-66;
docs/tools/mcp-manual.md:49-56, 85-87, 140-142, 185-190, 232-234;
docs/sandbox/cloudflare.md:35-38, 121-123. Leave sites that do not contain an
OpenAI model reference unchanged.

Source: Coding guidelines

docs/tools/mcp-manual.md (1)

72-96: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Close MCP clients on the resource, prompt-body, and cancellation examples.

The resource example and final cancellation example create a manual MCP client and never call mcp.close(). The finally prompt-body example also contains mcp.close() inside only one of its try/finally branches. Either add middleware: [{ ..., onFinish: () => mcp.close(), onAbort: () => mcp.close(), onError: () => mcp.close() }] or close on every terminal path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/tools/mcp-manual.md` around lines 72 - 96, Ensure every manual MCP
client is closed on all terminal paths: in docs/tools/mcp-manual.md lines 72-96,
add cleanup for the resource example’s mcp client; in docs/tools/mcp-manual.md
lines 169-193, add cleanup for the cancellation example. Also update the finally
prompt-body example so mcp.close() executes regardless of which try/finally
branch completes, using middleware terminal callbacks or equivalent
comprehensive cleanup.
docs/code-mode/code-mode-isolates.md (1)

90-103: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Security Misconfiguration (CWE-306): Missing Authentication for Critical Function

Reachability: External

Require deployment-time protection for Cloudflare isolate Workers.

The driver sends Authorization only when configured, with no Worker-side check shown and no default protection. A public workerUrl with the eval Worker can therefore accept code and use isolate/resources without authentication. Mark production protection required, avoid labeling this option optional for deployments outside trusted infrastructure, and document the required Worker-side Auth or Cloudflare Access enforcement.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/code-mode/code-mode-isolates.md` around lines 90 - 103, Update the
Cloudflare isolate driver documentation to require deployment-time
authentication for production or untrusted infrastructure: describe Worker-side
authorization or Cloudflare Access enforcement, and state that the workerUrl
must not expose the eval Worker publicly without protection. Revise the
authorization option’s description from optional to deployment-required, while
preserving its role as the Authorization header configuration.
docs/resumable-streams/advanced.md (1)

58-71: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Pair client usage with the required server endpoint.

  • docs/resumable-streams/advanced.md#L58-L71: add the offset=-1 GET handler or link to its exact complete example.
  • docs/api/ai-preact.md#L27-L65: add a minimal POST /api/chat route or link to an exact server/client example.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/resumable-streams/advanced.md` around lines 58 - 71, Pair the client
examples with complete server endpoint guidance: in
docs/resumable-streams/advanced.md lines 58-71, add the required offset=-1 GET
handler or link to its exact complete example; in docs/api/ai-preact.md lines
27-65, add a minimal POST /api/chat route or link to an exact server/client
example.

Source: Coding guidelines

docs/tools/server-tools.md (1)

78-103: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Bound and validate the external API call.

fetch() can wait indefinitely, and response.json() runs for 4xx and 5xx responses. A provider timeout or non-JSON error can hang the tool loop or produce an uncontrolled tool error. Add a timeout, check response.ok, and return a schema-compatible error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/tools/server-tools.md` around lines 78 - 103, Update the server
implementation of searchProducts to bound the external fetch with an AbortSignal
timeout, validate response.ok before parsing, and return a schema-compatible
error result for timeouts, non-2xx responses, or invalid JSON. Preserve the
existing successful JSON response and server-only API_KEY usage.
docs/media/text-to-speech.md (1)

248-260: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Revoke generated Blob URLs.

SpeechPlayer.onResult creates a new object URL for each result, but this example never calls URL.revokeObjectURL. Add cleanup with useEffect when result changes and on unmount so URL reuses do not retain Blob data.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/media/text-to-speech.md` around lines 248 - 260, Update SpeechPlayer and
its onResult handling to retain each generated Blob URL and use a useEffect tied
to result changes that revokes the previous URL, also revoking the final URL
during unmount. Preserve audio creation while ensuring every URL from
URL.createObjectURL is eventually passed to URL.revokeObjectURL.
docs/persistence/build-your-own-generation-adapter.md (1)

87-108: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate persisted JSON before mapping it.

mapGenerationRun and mapBlobRecord call JSON.parse directly on database columns. A truncated or corrupt row can make get, findLatestForThread, or blob reads throw instead of returning a controlled result.

Use a per-field type guard or Standard Schema parser. Handle invalid records explicitly before constructing the returned store record.

Based on learnings, persisted values must be narrowed or validated before use so corrupt records cannot surface as runtime failures.

Also applies to: 322-324

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/persistence/build-your-own-generation-adapter.md` around lines 87 - 108,
Validate each persisted JSON field before mapping it in mapGenerationRun and
mapBlobRecord, replacing direct JSON.parse calls with the established type guard
or Standard Schema validation approach. Handle parse or validation failures
explicitly so get, findLatestForThread, and blob reads return a controlled
result rather than throwing, while preserving valid records and omitting or
reporting invalid optional fields as appropriate.

Source: Learnings

docs/api/ai-react.md (1)

15-68: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Show both sides of each runnable flow.

Both pages show a client that calls a server endpoint but omit the matching server implementation. Add a concise server example or a direct link to a complete server/client example.

  • docs/api/ai-react.md#L15-L68: add the /api/chat endpoint that returns TanStack AI SSE.
  • docs/interrupts/generic.md#L87-L96: add the server interrupt emission and resume-validation example.

As per coding guidelines, documentation code samples should show both server and client sides when applicable.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/api/ai-react.md` around lines 15 - 68, Complete the runnable flow in
docs/api/ai-react.md (lines 15-68) by adding a concise server implementation for
/api/chat that returns TanStack AI SSE and matches the
useChat/fetchServerSentEvents client example. Also update
docs/interrupts/generic.md (lines 87-96) with the corresponding server interrupt
emission and resume-validation example; both documented sites require direct
changes.

Source: Coding guidelines

docs/structured-outputs/multi-turn.md (1)

84-99: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Move the shared schema out of the route module.

The client imports RecipeSchema and Recipe from the /api/structured-chat route module, which also imports @tanstack/ai, @tanstack/ai-openai, and server utilities. Put RecipeSchema and Recipe in a shared module and import that module from both the server route and the client.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/structured-outputs/multi-turn.md` around lines 84 - 99, Move
RecipeSchema and the Recipe type out of the api/structured-chat route module
into a shared schema module, then update both the structured chat route and
StructuredChatPage imports to use that shared module. Keep server-only
dependencies confined to the route and preserve the existing schema and type
usage.
docs/structured-outputs/with-tools.md (1)

68-78: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Complete the cross-boundary documentation examples.

These rewrites leave several server/client flows one-sided. Add the missing counterpart or link to an exact complete example.

  • docs/structured-outputs/with-tools.md#L68-L78: add the server POST handler for /api/recommend.
  • docs/structured-outputs/with-tools.md#L118-L137: add the server route used by the client-tool example.
  • docs/community-adapters/mynth.md#L134-L150: add client consumption for the SSE image-generation endpoint.
  • docs/api/ai-solid.md#L16-L66: add or link to the /api/chat server handler.
  • docs/api/ai-solid.md#L127-L138: add or link to the /api/chat server handler.
  • docs/api/ai-solid.md#L247-L288: add or link to the /api/chat server handler for client tools.
  • docs/code-mode/lazy-tools.md#L62-L88: add client consumption for the Code Mode SSE route.
  • docs/code-mode/lazy-tools.md#L151-L171: add client consumption for the plain chat() SSE route.

As per coding guidelines, documentation examples must show both server and client sides when applicable.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/structured-outputs/with-tools.md` around lines 68 - 78, Complete the
cross-boundary documentation examples by adding the missing counterpart or
linking to an exact complete example: in docs/structured-outputs/with-tools.md
lines 68-78, add the server POST handler for /api/recommend; in lines 118-137,
add the server route for the client-tool example; in
docs/community-adapters/mynth.md lines 134-150, add client consumption for the
SSE image-generation endpoint; in docs/api/ai-solid.md lines 16-66, 127-138, and
247-288, add or link to the /api/chat server handler, including the client-tools
variant; and in docs/code-mode/lazy-tools.md lines 62-88 and 151-171, add client
consumption for the respective Code Mode and plain chat() SSE routes. Ensure
each applicable example shows both server and client sides.

Source: Coding guidelines

🟠 Major comments (24)
docs/adapters/gemini.md-127-127 (1)

127-127: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Store the first interaction before resuming it.

The text requires store: true for multi-turn interactions, but the first chat() call at Lines 137-140 does not set it. Add modelOptions: { store: true } to the first request before using its interaction ID.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adapters/gemini.md` at line 127, Update the first chat() request in the
stateful conversation example to include modelOptions with store enabled,
ensuring its interaction ID is persisted before the subsequent request resumes
it.
docs/adapters/fal.md-142-143 (1)

142-143: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Poll until the video job reaches a terminal state.

The text describes a submit → poll → URL flow, but the example calls getVideoJobStatus() only once. A pending job has no final URL. Loop until completed or failed, then handle the terminal result.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adapters/fal.md` around lines 142 - 143, Update the video job example
around getVideoJobStatus() to poll repeatedly until the job reaches the
completed or failed terminal state, rather than checking status only once. Only
access or handle the final video URL after completion, and preserve explicit
failure handling for failed jobs.
docs/adapters/acp-compatible.md-200-204 (2)

200-204: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add the client side of the session-resume flow.

This section requires capturing <name>.session-id and sending it back in modelOptions.sessionId, but it provides only server code. Add a client example that consumes the custom event and sends the next request.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adapters/acp-compatible.md` around lines 200 - 204, Extend the “Session
resume” section with a client-side example that listens for the
<name>.session-id custom event, stores the received session ID, and includes it
as modelOptions.sessionId on the next request while sending only the latest user
message.

Source: Coding guidelines


200-204: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Add client consumption to each server endpoint example.

The documentation rule requires both server and client sides when applicable.

  • docs/adapters/acp-compatible.md#L200-L204: add client handling for the session ID custom event and the next resume request.
  • docs/adapters/anthropic.md#L57-L57: add a client for the basic SSE endpoint.
  • docs/adapters/anthropic.md#L75-L75: add a client for the tool-enabled SSE endpoint.
  • docs/adapters/gemini.md#L62-L62: add a client for the tool-enabled endpoint.
  • docs/adapters/grok.md#L58-L58: add a client for the tool-enabled endpoint.
  • docs/adapters/groq.md#L59-L59: add a client for the SSE endpoint.
  • docs/adapters/mistral.md#L82-L82: add a client for the tool-enabled endpoint.
  • docs/adapters/ollama.md#L68-L68: add a client for the tool-enabled endpoint.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adapters/acp-compatible.md` around lines 200 - 204, Extend the
server-only documentation with client consumption examples: in
docs/adapters/acp-compatible.md lines 200-204, show handling the session-ID
custom event and sending the next resume request with modelOptions.sessionId;
add client examples for the basic and tool-enabled SSE endpoints at
docs/adapters/anthropic.md lines 57 and 75, and for the tool-enabled endpoints
at docs/adapters/gemini.md line 62, docs/adapters/grok.md line 58,
docs/adapters/mistral.md line 82, and docs/adapters/ollama.md line 68; add a
client example for the SSE endpoint at docs/adapters/groq.md line 59. Use each
document’s existing endpoint and request conventions.

Source: Coding guidelines

docs/adapters/byteplus.md-173-175 (1)

173-175: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use one exact model ID for structured output.

Line 175 names dola-seed-2-0-lite-260228, but the model list at Lines 412-418 names seed-2-0-lite-260228. Use the exact exported model ID so readers do not receive a model-not-found or unsupported-model error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adapters/byteplus.md` around lines 173 - 175, Update the structured
output model reference in the “Structured output” documentation to use the exact
exported ID `seed-2-0-lite-260228`, matching the model list and
`BYTEPLUS_STRUCTURED_OUTPUT_CHAT_MODELS`; remove the incorrect `dola-` prefix.
docs/adapters/acp-compatible.md-131-136 (1)

131-136: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Remove the as assertion from modelOptions examples.

The acpCompatible.md examples at lines 102 and 135 use modelOptions: {} as { reasoningEffort?: ... }. Replace it with an assertion-free type-only shape (for example, use the adapter interface type only, or describe the custom options without providing a runtime empty object cast).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adapters/acp-compatible.md` around lines 131 - 136, Update the
modelOptions examples in the acp-compatible documentation, including the
modelOptions field description, to remove the `as` type assertions. Describe the
custom type-only options shape without presenting a runtime empty object cast,
while preserving the documented typing behavior for chat({ modelOptions }).

Source: Coding guidelines

docs/adapters/openai-compatible.md-82-88 (1)

82-88: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use current DeepSeek model IDs.

deepseek-chat and deepseek-reasoner are retired on the DeepSeek API. Replace these examples, one-shot calls, model declarations, and the provider table entry (line:128) with active identifiers such as deepseek-v4-flash/deepseek-v4-pro, and adjust the capability metadata accordingly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adapters/openai-compatible.md` around lines 82 - 88, Update all DeepSeek
references in the documentation, including examples, one-shot calls, model
declarations, and the provider table, to use active model IDs such as
deepseek-v4-flash or deepseek-v4-pro instead of deepseek-chat and
deepseek-reasoner. Adjust each createModel capability declaration to match the
selected model’s supported features.

Source: Coding guidelines

docs/persistence/build-your-own-adapter.md-120-120 (1)

120-120: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Limit the conformance claim to declared capabilities.

The preceding example skips generationRuns, artifacts, and blobs. A green result cannot prove drop-in support for withGenerationPersistence. State that the result covers only unskipped capabilities, or remove those skips before claiming both integrations.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/persistence/build-your-own-adapter.md` at line 120, Update the
conformance statement in the persistence adapter documentation to limit a green
result to the capabilities actually tested, since the example skips
generationRuns, artifacts, and blobs. Either state that the result covers only
unskipped capabilities or remove those skips before claiming support for both
withPersistence and withGenerationPersistence.
docs/advanced/runtime-adapter-switching.md-31-36 (1)

31-36: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate the provider before indexing adapters.

body.forwardedProps?.provider is runtime JSON. The Provider annotation does not validate it. An unknown value makes adapters[provider]() throw. Allowlist the value and return a 400 response or use the default. Apply the same validation to the full-route, image, and summarize examples.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/advanced/runtime-adapter-switching.md` around lines 31 - 36, Validate
the runtime provider value before calling adapters[provider]() in handleRequest,
rather than relying on the Provider annotation; allow only supported adapter
keys and return a 400 response or fall back to the default for unknown values.
Apply the same allowlist validation to the full-route, image, and summarize
examples.
docs/persistence/build-your-own-adapter.md-86-86 (1)

86-86: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not generalize retry safety from idempotent creates.

No cross-system transaction remains. Idempotent creates do not protect transcript overwrites, status transitions, or multi-store ordering. Document idempotency or transaction requirements for every operation, or describe compensation and conflict handling.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/persistence/build-your-own-adapter.md` at line 86, Update the
transaction and retry-safety guidance in the persistence adapter documentation:
do not imply that idempotent creates make all retries safe. Cover requirements
for transcript overwrites, status transitions, and multi-store ordering, or
document the required compensation and conflict-handling behavior for those
operations.
docs/persistence/client-persistence.md-160-160 (1)

160-160: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Make corrupt persisted records fail safely.

The custom adapter above can throw from JSON.parse, and its guard accepts any messages array without validating message entries or resume. This contradicts the statement that wrong shapes fail silently and can break useChat during hydration. Use a shipped adapter, or parse the complete record with a schema inside try/catch and return null on failure.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/persistence/client-persistence.md` at line 160, Update the custom
persistence adapter described in the surrounding documentation to validate the
complete persisted record, including message entries and resume, inside a
try/catch; return null for JSON.parse errors or schema mismatches so corrupt
records fail safely during useChat hydration. Prefer the shipped adapter if it
already provides this validation.

Source: Learnings

docs/api/ai-vue.md-265-268 (1)

265-268: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Other (CWE-20): Improper Input Validation

Reachability: External

Do not expose a generic localStorage writer to the model.

saveToStorage allows model-controlled key and value inputs, then calls localStorage.setItem(input.key, input.value). An attacker or prompt injection can use this client tool to overwrite arbitrary same-origin storage keys.

Replace it with application-specific setters, or allowlist only safe storage keys and reject session/credential/security-related keys.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/api/ai-vue.md` around lines 265 - 268, Update the tools supplied to
useChat so saveToStorage cannot write arbitrary model-controlled localStorage
keys or values. Replace it with application-specific setter tools, or enforce an
explicit allowlist that rejects session, credential, and security-related keys
before calling localStorage.setItem.
docs/memory/custom-adapter.md-43-47 (1)

43-47: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reconcile the receipt rule with the scaffold.

The contract says one SaveReceipt per write, but save() inserts two rows and returns one receipt. Either return one receipt for each insert or change the contract wording and contract-suite expectation to one receipt per save() call.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/memory/custom-adapter.md` around lines 43 - 47, Reconcile the “one
SaveReceipt per write” rule with the documented save scaffold: either update
save() to return a receipt for each of its two inserts, or revise the rule and
contract-suite expectation to require one receipt per save() call. Keep the
chosen behavior consistent across the contract wording, save() implementation,
and tests.
docs/persistence/keep-generated-files.md-82-85 (1)

82-85: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Authorization Bypass (CWE-862): Missing Authorization

Reachability: External

Replace the hardcoded ownership result before publishing this example.

artifactId comes from the request, but const owned = true authorizes every caller. This path can then retrieve and return another user’s persisted artifact bytes. Enforce authenticated tenant, thread, and run ownership, and keep the existing 404 response for non-owned artifacts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/persistence/keep-generated-files.md` around lines 82 - 85, Replace the
hardcoded owned value in the artifact retrieval example with validation of the
authenticated tenant, thread, and run against the requested artifactId and its
persisted metadata. Return the existing 404 Response whenever ownership
validation fails, and only retrieve or return artifact bytes after all ownership
checks pass.
docs/memory/adapters.md-101-113 (1)

101-113: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Document Redis key escaping and migration status.

redis() still escapes :, \, and _ in Redis scope values, so this does not match {prefix}:index:{tenantId|_}:{userId|_}:{threadId} and could miss existing literal _ keys. Also state that older index layouts are not supported without migration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/memory/adapters.md` around lines 101 - 113, Update the Redis key
documentation near the index-key format to describe escaping of :, \, and _ in
redis() scope values, including how escaped values distinguish literal
underscores from missing dimensions. State that older Redis index layouts are
unsupported unless explicitly migrated, while keeping the adapter scope table
accurate.
docs/memory/adapters.md-129-136 (1)

129-136: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Sensitive Data Exposure (CWE-532): Insertion of Sensitive Information into Log File

Reachability: External

Do not log the raw Hindsight recall query.

onToolRecall receives the query string before filtering, and this example writes it to console logs with retrieved fragments. Log only non-sensitive event metadata, or redact the query before logging.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/memory/adapters.md` around lines 129 - 136, The onToolRecall example
currently logs the raw recall query, which may contain sensitive data. Update
the onToolRecall callback in the hindsight example to omit query from console
output or replace it with a suitable redacted representation, while retaining
only non-sensitive recall metadata such as fragment count.
docs/media/image-generation.md-200-205 (1)

200-205: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make the OpenAI inpaint example valid by default.

Lines 200-205 call openaiImage('gpt-image-2') without allowUrlFetch, then pass HTTP(S) url inputs. Because OpenAI image edits default to rejecting http:///https:// sources and require real bytes, use data inputs here, or construct createOpenaiImage with allowUrlFetch: true, matching the documentation above.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/media/image-generation.md` around lines 200 - 205, Update the OpenAI
inpaint example using openaiImage('gpt-image-2') so its HTTP(S) photoUrl and
maskUrl inputs are accepted by default: either convert them to data inputs
containing real bytes, or configure createOpenaiImage with allowUrlFetch: true
as documented above.
docs/advanced/built-in-middleware.md-88-88 (1)

88-88: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Connect the Redis client before using it.

createClient() returns a closed client. The example calls redis.get, redis.set, and redis.del without await redis.connect(), so the first cache operation fails. Connect the client during application startup or pass an already-connected client.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/advanced/built-in-middleware.md` at line 88, Update the Redis cache
example to ensure the client returned by createClient() is connected with await
redis.connect() during application startup before any chat() calls perform
redis.get, redis.set, or redis.del; alternatively, document that the supplied
storage client must already be connected.
docs/sandbox/quick-start.md-23-23 (1)

23-23: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Install or verify the grok CLI in the quick-start image.

The example uses node:22, but the setup does not install grok. The later grokBuildText('grok-build') call therefore cannot run as written. Use an image that contains the CLI, or add an installation and version check to setup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/sandbox/quick-start.md` at line 23, Update the quick-start sandbox setup
around the node:22 image so the grok CLI is installed or verified before use.
Ensure the setup step confirms the CLI is available, including a version check,
before grokBuildText('grok-build') runs; alternatively use an image that already
contains grok.
docs/community-adapters/decart.md-71-105 (1)

71-105: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Bound the video polling loop.

If Decart never returns a terminal status, for (;;) waits forever. Add a deadline or maximum attempt count and report a timeout error.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/community-adapters/decart.md` around lines 71 - 105, Bound the polling
loop in createVideo by adding a deadline or maximum attempt count, and throw a
clear timeout error when polling exceeds that limit without reaching completed
or failed status. Preserve the existing 5-second polling interval and
terminal-status handling.
docs/persistence/build-your-own-chat-adapter.md-54-65 (1)

54-65: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Validate persisted JSON before returning it to useChat.

The createMessageStore example assigns JSON.parse(json) directly to Array<ModelMessage>. A corrupt row can throw during rehydration or return invalid message objects. Add a type guard or Standard Schema parser, and apply the same validation to usage, interrupt payloads, responses, and metadata.
Based on learnings, persistence examples must narrow or validate parsed values before use. <retrieved_learnings>

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/persistence/build-your-own-chat-adapter.md` around lines 54 - 65, Update
the createMessageStore example and its load, usage, interrupt, response, and
metadata rehydration paths to validate parsed JSON before returning or using it.
Add a type guard or Standard Schema parser that rejects malformed values,
handles parse or validation failures safely, and ensures only validated
ModelMessage arrays and associated persisted payloads reach useChat.

Source: Learnings

docs/advanced/built-in-middleware.md-213-213 (1)

213-213: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Consume the default stream in the OTel example.

chat() defaults to streaming. await chat(...) does not consume the returned AsyncIterable, so the request and middleware spans may not run. Set stream: false for a one-shot result, or iterate the stream.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/advanced/built-in-middleware.md` at line 213, Update the OTel example’s
chat invocation to explicitly set stream: false so awaiting chat() returns and
consumes a one-shot result, ensuring the request and middleware spans execute
without changing the example’s intended behavior.
docs/resumable-streams/custom-adapter.md-120-125 (1)

120-125: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject gaps in the upsert suffix.

The rule requires a contiguous suffix, but makeUpsert only rejects offsets at or before tail. An offset at tail + 2 passes and creates a missing position. Later reads can then skip a chunk permanently.

For each new entry, require seq === tail + 1 before advancing tail.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/resumable-streams/custom-adapter.md` around lines 120 - 125, Update
makeUpsert’s batch validation to enforce a contiguous suffix: for each new
entry, require its sequence offset to equal tail + 1 before advancing tail,
rejecting gaps such as tail + 2 while preserving existing rejection of stale or
duplicate offsets.
docs/sandbox/events.md-148-167 (1)

148-167: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Handle mixed tool-call messages before dropping sandbox results.

If an assistant message includes both sandbox and non-sandbox tool calls, calls.every(isSandboxToolCall) keeps the message, but the matching sandbox result is later skipped. The restored history then pairs a non-sandbox assistant turn with dropped sandbox tool results. Filter only sandbox tool calls from mixed messages, keep non-sandbox calls, and track sandbox result IDs separately.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/sandbox/events.md` around lines 148 - 167, Update saveThread so messages
containing mixed sandbox and non-sandbox tool calls retain only the non-sandbox
calls instead of being kept unchanged. Track IDs only for removed sandbox calls,
and continue skipping tool results whose toolCallId matches those IDs, while
preserving messages containing no sandbox calls.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 105297e5-53aa-4ff8-bbe7-94c36889ea63

📥 Commits

Reviewing files that changed from the base of the PR and between aade077 and 7be519e.

📒 Files selected for processing (142)
  • docs/adapters/acp-compatible.md
  • docs/adapters/anthropic.md
  • docs/adapters/bedrock.md
  • docs/adapters/byteplus.md
  • docs/adapters/claude-code.md
  • docs/adapters/codex.md
  • docs/adapters/elevenlabs.md
  • docs/adapters/fal.md
  • docs/adapters/gemini.md
  • docs/adapters/grok-build.md
  • docs/adapters/grok.md
  • docs/adapters/groq.md
  • docs/adapters/mistral.md
  • docs/adapters/ollama.md
  • docs/adapters/openai-compatible.md
  • docs/adapters/openai.md
  • docs/adapters/opencode.md
  • docs/adapters/openrouter.md
  • docs/advanced/built-in-middleware.md
  • docs/advanced/debug-logging.md
  • docs/advanced/extend-adapter.md
  • docs/advanced/locks.md
  • docs/advanced/middleware.md
  • docs/advanced/multimodal-content.md
  • docs/advanced/otel.md
  • docs/advanced/per-model-type-safety.md
  • docs/advanced/runtime-adapter-switching.md
  • docs/advanced/runtime-context.md
  • docs/advanced/tree-shaking.md
  • docs/advanced/typed-options.md
  • docs/api/ai-angular.md
  • docs/api/ai-client.md
  • docs/api/ai-preact.md
  • docs/api/ai-react.md
  • docs/api/ai-solid.md
  • docs/api/ai-svelte.md
  • docs/api/ai-vue.md
  • docs/api/ai.md
  • docs/architecture/approval-flow-processing.md
  • docs/chat/agentic-cycle.md
  • docs/chat/connection-adapters.md
  • docs/chat/streaming.md
  • docs/chat/structured-outputs.md
  • docs/chat/thinking-content.md
  • docs/code-mode/client-integration.md
  • docs/code-mode/code-mode-isolates.md
  • docs/code-mode/code-mode-with-skills.md
  • docs/code-mode/code-mode.md
  • docs/code-mode/lazy-tools.md
  • docs/community-adapters/cencori.md
  • docs/community-adapters/cloudflare.md
  • docs/community-adapters/decart.md
  • docs/community-adapters/guide.md
  • docs/community-adapters/mynth.md
  • docs/community-adapters/soniox.md
  • docs/comparison/vercel-ai-sdk.md
  • docs/config.json
  • docs/getting-started/agent-skills.md
  • docs/getting-started/devtools.md
  • docs/getting-started/overview.md
  • docs/getting-started/quick-start-angular.md
  • docs/getting-started/quick-start-react-native.md
  • docs/getting-started/quick-start-server.md
  • docs/getting-started/quick-start-svelte.md
  • docs/getting-started/quick-start-vue.md
  • docs/getting-started/quick-start.md
  • docs/interrupts/generic.md
  • docs/interrupts/migration.md
  • docs/interrupts/multiple.md
  • docs/interrupts/overview.md
  • docs/interrupts/tool-approval.md
  • docs/mcp/apps.md
  • docs/media/audio-generation.md
  • docs/media/audio-recording.md
  • docs/media/generation-hooks.md
  • docs/media/generations.md
  • docs/media/image-generation.md
  • docs/media/realtime-chat.md
  • docs/media/text-to-speech.md
  • docs/media/transcription.md
  • docs/media/video-generation.md
  • docs/memory/adapters.md
  • docs/memory/custom-adapter.md
  • docs/memory/operating.md
  • docs/memory/overview.md
  • docs/memory/quickstart.md
  • docs/migration/ag-ui-compliance.md
  • docs/migration/migration-from-vercel-ai.md
  • docs/migration/migration.md
  • docs/migration/sampling-options-to-model-options.md
  • docs/persistence/build-a-sandbox-adapter.md
  • docs/persistence/build-your-own-adapter.md
  • docs/persistence/build-your-own-chat-adapter.md
  • docs/persistence/build-your-own-generation-adapter.md
  • docs/persistence/chat-persistence.md
  • docs/persistence/client-persistence.md
  • docs/persistence/controls.md
  • docs/persistence/generation-persistence.md
  • docs/persistence/id-map.md
  • docs/persistence/internals.md
  • docs/persistence/keep-generated-files.md
  • docs/persistence/migrations.md
  • docs/persistence/overview.md
  • docs/persistence/store-reference.md
  • docs/protocol/custom-events.md
  • docs/resumable-streams/advanced.md
  • docs/resumable-streams/custom-adapter.md
  • docs/resumable-streams/overview.md
  • docs/sandbox/cloudflare.md
  • docs/sandbox/durability.md
  • docs/sandbox/durable-runs.md
  • docs/sandbox/events.md
  • docs/sandbox/harnesses.md
  • docs/sandbox/journal.md
  • docs/sandbox/lifecycle.md
  • docs/sandbox/observability.md
  • docs/sandbox/overview.md
  • docs/sandbox/policy.md
  • docs/sandbox/providers.md
  • docs/sandbox/provisioning.md
  • docs/sandbox/quick-start.md
  • docs/sandbox/reaping.md
  • docs/sandbox/takeover.md
  • docs/sandbox/tools.md
  • docs/sandbox/workspace.md
  • docs/structured-outputs/multi-turn.md
  • docs/structured-outputs/one-shot.md
  • docs/structured-outputs/overview.md
  • docs/structured-outputs/streaming.md
  • docs/structured-outputs/with-tools.md
  • docs/tools/client-tools.md
  • docs/tools/lazy-tool-discovery.md
  • docs/tools/mcp-codegen.md
  • docs/tools/mcp-managed.md
  • docs/tools/mcp-manual.md
  • docs/tools/mcp.md
  • docs/tools/provider-skills.md
  • docs/tools/provider-tools.md
  • docs/tools/server-tools.md
  • docs/tools/tool-approval.md
  • docs/tools/tool-architecture.md
  • docs/tools/tools.md

Keep action-first prose; fold in structured-output finalization span
behavior from #1055.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant