Conversation
e945e91 to
9af320e
Compare
9af320e to
e4ad6ff
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.5.0
Minor Changes
a6ec9b0Thanks @threepointone! - Add retry utilities:this.retry(), per-task retry options, andRetryOptionstypethis.retry(fn, options?)— retry any async operation with exponential backoff and jitter. Accepts optionalshouldRetrypredicate to bail early on non-retryable errors.queue(),schedule(),scheduleEvery()accept{ retry?: RetryOptions }for per-task retry configuration, persisted in SQLite alongside the task.addMcpServer()accepts{ retry?: RetryOptions }for configurable MCP connection retries.RetryOptionstype is exported for TypeScript consumers.static options = { retry: { ... } }— override defaults for an entire agent class.terminateWorkflow,pauseWorkflow, etc.) with Durable Object-aware error detection.Patch Changes
#899
04c6411Thanks @threepointone! - Fix React hooks exhaustive-deps warning in useAgent by referencing cacheInvalidatedAt inside useMemo body.#904
d611b94Thanks @ask-bonk! - Fix TypeScript "excessively deep" error with deeply nested state typesAdd a depth counter to
CanSerializeandIsSerializableParamtypes that bails out totrueafter 10 levels of recursion. This prevents the "Type instantiation is excessively deep and possibly infinite" error when using deeply nested types like AI SDKCoreMessage[]as agent state.#911
67b1601Thanks @threepointone! - Update all dependencies and fix breaking changes.Update all dependencies, add required
aria-labelprops to KumoButtoncomponents withshape(now required for accessibility), and fix state test for constructor-time validation of conflictingonStateChanged/onStateUpdatehooks.#889
9100e65Thanks @deathbyknowledge! - Fix scheduling schema compatibility with zod v3 and improve schema structure.zod/v3import tozodso the package works for users on zod v3 (who don't have thezod/v3subpath).z.discriminatedUniononwhen.type. Each scheduling variant now only contains the fields it needs, making the schema cleaner and easier for LLMs to follow.z.coerce.date()withz.string(). Zod v4'stoJSONSchema()cannot representDate, and the AI SDK routes zod v4 schemas through it directly. Dates are now returned as ISO 8601 strings.Schedule["when"]is now a discriminated union instead of a flat object with optional fields.when.dateisstringinstead ofDate.#916
24e16e0Thanks @threepointone! - Widen peer dependency ranges across packages to prevent cascading major bumps during 0.x minor releases. Mark@cloudflare/ai-chatand@cloudflare/codemodeas optional peer dependencies ofagentsto fix unmet peer dependency warnings during installation.#898
cd2d34fThanks @jvg123! - Add keepalive ping to POST SSE response streams in WorkerTransportThe GET SSE handler already sends
event: pingevery 30 seconds to keep the connection alive, but the POST SSE handler did not. This caused POST response streams to be silently dropped by proxies and infrastructure during long-running tool calls (e.g., MCP tools/call), resulting in clients never receiving the response.#874
a6ec9b0Thanks @threepointone! - Make queue and schedule getter methods synchronousgetQueue(),getQueues(),getSchedule(),dequeue(),dequeueAll(), anddequeueAllByCallback()were unnecessarilyasyncdespite only performing synchronous SQL operations. They now return values directly instead of wrapping them in Promises. This is backward compatible — existing code usingawaiton these methods will continue to work.@cloudflare/ai-chat@0.1.0
Minor Changes
#899
04c6411Thanks @threepointone! - Refactor AIChatAgent: extract ResumableStream class, add WebSocket ChatTransport, simplify SSE parsing.Bug fixes:
setMessagesfunctional updater sending empty array to server_sendPlaintextReplycreating multiple text parts instead of oneCF_AGENT_MESSAGE_UPDATEDnot broadcast for streaming messages_streamCompletionPromisenot resolved on error (tool continuations could hang)bodylost during tool continuations (now preserved alongsideclientTools)clearAll()not clearing in-memory chunk buffer (orphaned chunks could flush after clear)reasoning-deltasilently dropping data whenreasoning-startwas missed (stream resumption)string.lengthinstead of UTF-8 byte count for SQLite limitscompletedguard on abort listener to prevent redundant cancel after stream completionNew features:
maxPersistedMessages— cap SQLite message storage with automatic oldest-message deletionbodyoption onuseAgentChat— send custom data with every request (static or dynamic)onFinishis now optional — framework handles abort controller cleanup and observabilityDocs:
docs/chat-agents.md— comprehensive AIChatAgent and useAgentChat referenceexamples/ai-chat/example with modern patterns and Workers AIDeprecations (with console.warn):
createToolsFromClientSchemas(),extractClientToolSchemas(),detectToolsRequiringConfirmation()tools,toolsRequiringConfirmation,experimental_automaticToolResolutionoptionsaddToolResult()(useaddToolOutput())#919
6b6497cThanks @threepointone! - ChangeautoContinueAfterToolResultdefault fromfalsetotrue.Client-side tool results and tool approvals now automatically trigger a server continuation by default, matching the behavior of server-executed tools (which auto-continue via
streamText's multi-step). This eliminates the most common setup friction with client tools — the LLM now responds after receiving tool results without requiring explicit opt-in.To restore the previous behavior, set
autoContinueAfterToolResult: falseinuseAgentChat.Patch Changes
#897
994a808Thanks @alexanderjacobsen! - Fix client tool schemas lost after DO restart by re-sending them with CF_AGENT_TOOL_RESULT#916
24e16e0Thanks @threepointone! - Widen peer dependency ranges across packages to prevent cascading major bumps during 0.x minor releases. Mark@cloudflare/ai-chatand@cloudflare/codemodeas optional peer dependencies ofagentsto fix unmet peer dependency warnings during installation.#912
baa87ccThanks @threepointone! - Persist request context across Durable Object hibernation.Persist
_lastBodyand_lastClientToolsto SQLite so custom body fields and client tool schemas survive Durable Object hibernation during tool continuation flows (issue ai-chat: forward or document body behavior during tool continuation path #887). Add test coverage for body forwarding during tool auto-continuation, and update JSDoc forOnChatMessageOptions.bodyto document tool continuation and hibernation behavior.#913
bc91c9aThanks @threepointone! - Sync_lastClientToolscache and SQLite when client tools arrive viaCF_AGENT_TOOL_RESULT, and align the wire type withClientToolSchema(JSONSchema7instead ofRecord<string, unknown>)#919
6b6497cThanks @threepointone! - Add auto-continuation support for tool approval (needsApproval).When a tool with
needsApproval: trueis approved viaCF_AGENT_TOOL_APPROVAL, the server can now automatically continue the conversation (matching the existingautoContinuebehavior ofCF_AGENT_TOOL_RESULT). The client hook passesautoContinuewith approval messages whenautoContinueAfterToolResultis enabled. Also fixes silent data loss wheretool-output-availableevents for tool calls in previous assistant messages were dropped during continuation streams by adding a cross-message fallback search in_streamSSEReply.#910
a668155Thanks @threepointone! - Add structural message validation and fix message metadata on broadcast/resume path.Structural message validation:
Messages loaded from SQLite are now validated for required structure (non-empty
idstring, validrole,partsis an array). Malformed rows — from corruption, manual tampering, or schema drift — are logged with a warning and silently skipped instead of crashing the agent. This is intentionally lenient: emptypartsarrays are allowed (streams that errored mid-flight), and no tool/data schema validation is performed at load time (that remains a userland concern viasafeValidateUIMessagesfrom the AI SDK).Message metadata on broadcast/resume path:
The server already captures
messageMetadatafromstart,finish, andmessage-metadatastream chunks and persists it onmessage.metadata. However, the client-side broadcast path (multi-tab sync) and stream resume path (reconnection) did not propagate metadata — theactiveStreamRefonly trackedparts. Now it also tracksmetadata, andflushActiveStreamToMessagesincludes it in the partial message flushed to React state. This means cross-tab clients and reconnecting clients see metadata (model info, token usage, timestamps) during streaming, not just after the finalCF_AGENT_CHAT_MESSAGESbroadcast.@cloudflare/codemode@0.0.8
Patch Changes
24e16e0Thanks @threepointone! - Widen peer dependency ranges across packages to prevent cascading major bumps during 0.x minor releases. Mark@cloudflare/ai-chatand@cloudflare/codemodeas optional peer dependencies ofagentsto fix unmet peer dependency warnings during installation.hono-agents@3.0.4
Patch Changes
24e16e0Thanks @threepointone! - Widen peer dependency ranges across packages to prevent cascading major bumps during 0.x minor releases. Mark@cloudflare/ai-chatand@cloudflare/codemodeas optional peer dependencies ofagentsto fix unmet peer dependency warnings during installation.