Patch Changes
-
#1411
2fa68beThanks @threepointone! - AddAbortRegistry.linkExternal(id, signal)for connecting externalAbortSignals to per-request abort controllers, and add"aborted"to theSaveMessagesResult.statusunion (#1406).linkExternalis the integration point for callers that drive a chat turn programmatically and want to cancel it from outside without knowing the internally-generated request id (the helper-as-sub-agent pattern, where a parent'sAbortSignalfrom the AI SDK toolexecuteneeds to land inside a sub-agent'ssaveMessagescall). When the external signal aborts, the registry's controller foridis cancelled — the same pathchat-request-canceltakes over the WebSocket. The returned detacher must be called infinallyto avoid leaking listeners on long-lived parent signals.SaveMessagesResult.statusnow includes"aborted"alongside"completed"and"skipped". Existing callers that only switch on"completed"are unaffected; turns cancelled via the new signal API surface as"aborted"rather than"completed".Also exposes
SaveMessagesOptionsfromagents/chatfor use by@cloudflare/thinkand@cloudflare/ai-chattyped APIs.AbortRegistry.cancel(id, reason?)now accepts an optional reason that flows through tosignal.reasonon the cancelled controller.See
cloudflare/agents#1406for the motivating use case. -
ca510d4Thanks @threepointone! - Tighten internal peer dependency floors to reflect the current monorepo set we actually test against:@cloudflare/ai-chat(>=0.0.8→>=0.5.2) and@cloudflare/codemode(>=0.0.7→>=0.3.4). Upper bound (<1.0.0) is unchanged.No runtime change in
agentsitself. The visible effect for consumers: pairing the latestagentswith a stale@cloudflare/ai-chat(<0.5.2) or@cloudflare/codemode(<0.3.4) now produces a peer warning where it previously did not. That's the intended signal — those older combinations are no longer tested in the monorepo.