Minor Changes
-
#1256
dfab937Thanks @threepointone! - Add durable fiber execution to the Agent base class.runFiber(name, fn)registers work in SQLite, holds akeepAliveref, and enables recovery viaonFiberRecoveredafter DO eviction.ctx.stash()andthis.stash()checkpoint progress that survives eviction.AIChatAgentgainsunstable_chatRecovery— when enabled, each chat turn is wrapped in a fiber.onChatRecoveryprovides provider-specific recovery (Workers AI continuation, OpenAI response retrieval, Anthropic synthetic message).continueLastTurn()appends to the interrupted assistant message seamlessly.Thinknow extendsAgentdirectly (no mixin). Fiber support is inherited from the base class.Breaking (experimental APIs only):
- Removed
withFibersmixin (agents/experimental/forever) - Removed
withDurableChatmixin (@cloudflare/ai-chat/experimental/forever) - Removed
./experimental/foreverexport from both packages - Think no longer has a
fibersflag — recovery is automatic via alarm housekeeping
- Removed
Patch Changes
-
#1259
1933eb4Thanks @threepointone! - Run fiber recovery eagerly inonStart()instead of deferring to the next alarm. Interrupted fibers are now detected immediately on the first request after DO wake, with the alarm path as a fallback. A re-entrancy guard prevents double recovery. -
#1263
e3ceb82Thanks @threepointone! - FixrouteAgentEmail()keeping the target DO non-hibernatable for ~100-120s afteronEmail()returns. Replaces bare closure RPC targets with a singleRpcTargetbridge (EmailBridge) that has explicitSymbol.disposelifecycle, allowing the runtime to tear down the bidirectional RPC session promptly instead of tying it to the caller's execution context lifetime. -
c5ca556Thanks @threepointone! - Capvitepeer dependency at>=6.0.0 <9.0.0to avoid silently accepting untested future major versions. -
#1271
0cc2daeThanks @threepointone! - Add optionalMCPServerFilterparameter togetAITools(),listTools(),listPrompts(),listResources(), andlistResourceTemplates()for scoping results to specific MCP servers by ID, name, or connection state. -
#1267
d1ee61aThanks @dmmulroy! - Fix MCP streamable HTTP client session lifecycle so closing connections explicitly terminates active sessions and persists session IDs across reconnects/restores. -
#1270
87b4512Thanks @threepointone! - Wire Session into Think as the storage layer, achieving full feature parity with AIChatAgent plus Session-backed advantages.Think (
@cloudflare/think):- Session integration:
this.messagesbacked bysession.getHistory(), tree-structured messages, context blocks, compaction, FTS5 search configureSession()override for context blocks, compaction, search, skills (sync or async)assembleContext()returns{ system, messages }with context block compositiononChatResponse()lifecycle hook fires from all turn paths- Non-destructive regeneration via
trigger: "regenerate-message"with Session branching saveMessages()for programmatic turn entry (scheduled responses, webhooks, proactive agents)continueLastTurn()for extending the last assistant response- Custom body persistence across hibernation
sanitizeMessageForPersistence()hook for PII redactionmessageConcurrencystrategies (queue/latest/merge/drop/debounce)resetTurnState()extracted as protected methodunstable_chatRecoverywithrunFiberwrapping on all 4 turn pathsonChatRecovery()hook withChatRecoveryContexthasPendingInteraction()/waitUntilStable()for quiescence detection- Re-export
Sessionfrom@cloudflare/think - Constructor wraps
onStart— subclasses never needsuper.onStart()
agents (
agents/chat):- Extract
AbortRegistry,applyToolUpdate+ builders,parseProtocolMessageinto sharedagents/chatlayer - Add
applyChunkToPartsexport for fiber recovery
AIChatAgent (
@cloudflare/ai-chat):- Refactor to use shared
AbortRegistryfromagents/chat - Add
continuationflag toOnChatMessageOptions - Export
getAgentMessages()and tool part helpers - Add
getHttpUrl()touseAgentreturn value
- Session integration: