Commit 80079b4
Readonly state (#28190)
* Add readonly connections documentation
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
* Split mixed TS+JSX code block to fix build
Co-authored-by: elithrar <elithrar@users.noreply.github.com>
* Fix build: unwrap JSX code blocks from TypeScriptExample
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).
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: elithrar <elithrar@users.noreply.github.com>1 parent 2e0dc1f commit 80079b4
1 file changed
Lines changed: 517 additions & 0 deletions
0 commit comments