Conversation
Sync documentation for PR #610 from cloudflare/agents repository. Adds comprehensive documentation for the new readonly connections feature, which allows restricting WebSocket connections from modifying agent state while still allowing them to receive state updates and call RPC methods. Key additions: - Server-side methods: shouldConnectionBeReadonly, setConnectionReadonly, isConnectionReadonly - Client-side API: onStateUpdateError callback - Usage examples for query parameters, RBAC, admin dashboards, and dynamic permissions - Behavior details including state sync and connection cleanup - Best practices for authentication, user feedback, and permission checks - Migration guide for existing agents Source PR: cloudflare/agents#610
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
|
/bonk review and address the build issues |
Co-authored-by: elithrar <elithrar@users.noreply.github.com>
SummaryThe CI build failed with: Root cause: The "Dynamic permission changes" example at Fix: Split the single code block into two separate
This follows the same pattern used elsewhere in the agents docs (e.g., |
|
/bonk still failing. Investigate the build issues and run |
TypeScriptExample uses ts-blank-space to strip TypeScript types, but ts-blank-space doesn't understand JSX syntax — it misinterprets JSX tags as generics, 'as' in JSX text as type assertions, and '!' as non-null assertions. This caused: 1. GameComponent block: <div> tag blanked out entirely, breaking Prettier's babel parser with 'Adjacent JSX elements' error 2. EditButton block: !canEdit silently corrupted to canEdit in the generated JavaScript tab Fix by removing the TypeScriptExample wrapper from these two JSX blocks, using plain fenced tsx code blocks instead (matching the pattern used in quick-start.mdx and guides/webhooks.mdx).
SummaryThe build was failing because two JSX code blocks were wrapped in Root cause:
Two blocks fixed in
Fix: Removed the Validation:
|
|
Preview URL: https://dc21af5f.preview.developers.cloudflare.com Files with changes (up to 15) |
Summary
Sync documentation for cloudflare/agents PR #610: Readonly state
This PR adds comprehensive documentation for the new readonly connections feature, which allows restricting certain WebSocket connections from modifying agent state while still allowing them to receive state updates and call RPC methods.
Changes
src/content/docs/agents/api-reference/readonly-connections.mdxshouldConnectionBeReadonly(),setConnectionReadonly(),isConnectionReadonly()onStateUpdateErrorcallbackSource
Test plan