Merged
Conversation
9718b67 to
9ed0437
Compare
9ed0437 to
6a385cd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
agents@0.6.0
Minor Changes
#565
0e9a607Thanks @mattzcarey! - Add RPC transport for MCP: connect an Agent to an McpAgent via Durable Object bindingsNew feature:
addMcpServerwith DO bindingAgents can now connect to McpAgent instances in the same Worker using RPC transport — no HTTP, no network overhead. Pass the Durable Object namespace directly:
The
addMcpServermethod now acceptsstring | DurableObjectNamespaceas the second parameter with proper TypeScript overloads, so HTTP and RPC paths are type-safe and cannot be mixed.Hibernation support
RPC connections survive Durable Object hibernation automatically. The binding name and props are persisted to storage and restored on wake-up, matching the behavior of HTTP MCP connections. No need to manually re-establish connections in
onStart().Deduplication
Calling
addMcpServerwith the same server name multiple times (e.g., across hibernation cycles) now returns the existing connection instead of creating duplicates. This applies to both RPC and HTTP connections. Connection IDs are stable across hibernation restore.Other changes
RPCClientTransportto accept aDurableObjectNamespaceand create the stub internally viagetServerByNamefrom partyserver, instead of requiring a pre-constructed stubRPCServerTransportto drop session management (unnecessary for DO-scoped RPC) and useJSONRPCMessageSchemafrom the MCP SDK for validation instead of 170 lines of hand-written validation_resolveRpcBinding,_buildRpcTransportOptions,_buildHttpTransportOptions, and_connectToMcpServerInternalfrom the Agent base class — RPC transport logic no longer leaks intoindex.tsAddRpcMcpServerOptionstype (discriminated fromAddMcpServerOptions) sopropsis only available when passing a bindingRPC_DO_PREFIXconstant used consistently across all RPC namingMCPClientManager.callToolpassingserverIdthrough toconn.client.callTool(it should be stripped before the call)getRpcServersFromStorage()andsaveRpcServerToStorage()toMCPClientManagerfor hibernation persistencerestoreConnectionsFromStoragenow skips RPC servers (restored separately by the Agent class which has access toenv)rpc.tsfrom 609 lines to 245 linestypes.tsfrom 108 lines to 26 linesmcp-rpc-transportexample to use Workers AI (no API keys needed), Kumo/agents-ui components, and Tailwind CSSPatch Changes
#973
969fbffThanks @threepointone! - Update dependencies#960
179b8cbThanks @mattzcarey! - Harden JSON Schema to TypeScript converter for production use$refresolution for internal JSON Pointers (#/definitions/...,#/$defs/...,#)prefixItemsfor JSON Schema 2020-12, arrayitemsfor draft-07)nullable: truesupport across all schema branches*/)generateTypes()so one malformed schema cannot crash the pipelineinputSchemaingetAITools()with a fallback to{ type: "object" }getAITools()so one bad MCP tool does not break the entire tool set#963
b848008Thanks @threepointone! - MakecallbackHostoptional inaddMcpServerfor non-OAuth serversPreviously,
addMcpServer()always required acallbackHost(either explicitly or derived from the request context) and eagerly created an OAuth auth provider, even when connecting to MCP servers that do not use OAuth. This made simple non-OAuth connections unnecessarily difficult, especially from WebSocket callable methods where the request context origin is unreliable.Now,
callbackHostand the OAuth auth provider are only required when the MCP server actually needs OAuth (returns a 401/AUTHENTICATING state). For non-OAuth servers,addMcpServer("name", url)works with no additional options. If an OAuth server is encountered without acallbackHost, a clear error is thrown: "This MCP server requires OAuth authentication. Provide callbackHost in addMcpServer options to enable the OAuth flow."The restore-from-storage flow also handles missing callback URLs gracefully, skipping auth provider creation for non-OAuth servers.
97c6702Thanks @threepointone! - Add one-time console warning when using RPC transport (DO binding) withaddMcpServer, noting the API is experimental and linking to the feedback issue.@cloudflare/ai-chat@0.1.4
Patch Changes
#967
c128447Thanks @threepointone! - Follow-up to fix(ai-chat): emit output-denied state for rejected tool approvals #956. AllowaddToolOutputto work with tools inapproval-requestedandapproval-respondedstates, not justinput-available. Also adds support forstate: "output-error"anderrorTextfields, enabling custom denial messages when rejecting tool approvals (addresses remaining items from @cloudflare/ai-chat: Tool approval denial does not produce atool_result#955).Additionally, tool approval rejections (
approved: false) now auto-continue the conversation whenautoContinueis set, so the LLM sees the denial and can respond naturally (e.g. suggest alternatives).This enables the Vercel AI SDK recommended pattern for client-side tool denial:
#958
f70a8b9Thanks @whoiskatrin! - Fix duplicate assistant message persistence when clients resend full history with local assistant IDs that differ from server IDs.AIChatAgent.persistMessages()now reconciles non-tool assistant messages against existing server history by content and order, reusing the server ID instead of inserting duplicate rows.#977
5426b6fThanks @dmmulroy! - ExposerequestIdinOnChatMessageOptionsso handlers can send properly-tagged error responses for pre-stream failures.Also fix
saveMessages()to pass the full options object (requestId,abortSignal,clientTools,body) toonChatMessageand use a consistent request ID for_reply.#973
969fbffThanks @threepointone! - Update dependencies#983
2785f10Thanks @threepointone! - Fix abort/cancel support for streaming responses. The framework now properly cancels the reader loop when the abort signal fires and sends a done signal to the client. Added a warning log when cancellation arrives but the stream has not closed (indicating the user forgot to passabortSignalto their LLM call). Also fixed vitest project configs to scope test file discovery and prevent e2e/react tests from being picked up by the wrong runner.#979
23c90eaThanks @mattzcarey! - Fix jsonSchema not initialized error when calling getAITools() in onChatMessage#980
00c576dThanks @threepointone! - Fix_sanitizeMessageForPersistencestripping Anthropicredacted_thinkingblocks. The sanitizer now strips OpenAI ephemeral metadata first, then filters out only reasoning parts that are truly empty (no text and no remainingproviderMetadata). This preserves Anthropic'sredacted_thinkingblocks (stored as empty-text reasoning parts withproviderMetadata.anthropic.redactedData) while still removing OpenAI placeholders. Fixes _sanitizeMessageForPersistence strips Anthropic redacted_thinking blocks #978.#953
bd22d60Thanks @mattzcarey! - Moved/get-messagesendpoint handling from a prototypeoverride onRequest()method to a constructor wrapper. This ensures the endpoint always works, even when users overrideonRequestwithout callingsuper.onRequest().#956
ab401a0Thanks @whoiskatrin! - Fix denied tool approvals (CF_AGENT_TOOL_APPROVALwithapproved: false) to transition tool parts tooutput-deniedinstead ofapproval-responded.This ensures
convertToModelMessagesemits atool_resultfor denied approvals, which is required by providers like Anthropic.Also adds regression tests for denied approval behavior, including rejection from
approval-requestedstate.#982
5a851beThanks @threepointone! - Undeprecate client tool APIs (createToolsFromClientSchemas,clientTools,AITool,extractClientToolSchemas, and thetoolsoption onuseAgentChat) for SDK/platform use cases where tools are defined dynamically at runtime. Fix spuriousdetectToolsRequiringConfirmationdeprecation warning when using thetoolsoption.@cloudflare/codemode@0.1.1
Patch Changes
#962
ef46d68Thanks @tumberger! - Validate tool arguments against Zod schema before execution in codemode sandbox#973
969fbffThanks @threepointone! - Update dependencies#960
179b8cbThanks @mattzcarey! - Harden JSON Schema to TypeScript converter for production use$refresolution for internal JSON Pointers (#/definitions/...,#/$defs/...,#)prefixItemsfor JSON Schema 2020-12, arrayitemsfor draft-07)nullable: truesupport across all schema branches*/)generateTypes()so one malformed schema cannot crash the pipelineinputSchemaingetAITools()with a fallback to{ type: "object" }getAITools()so one bad MCP tool does not break the entire tool set#961
f6aa79fThanks @mattzcarey! - Updated default tool prompt to explicitly request JavaScript code from LLMs, preventing TypeScript syntax errors in the Dynamic Worker executor.hono-agents@3.0.6
Patch Changes
969fbffThanks @threepointone! - Update dependencies