Patch Changes
-
#1275
37b2ce3Thanks @threepointone! - Add built-in workspace to Think. Every Think instance now hasthis.workspacebacked by the DO's SQLite storage, and workspace tools (read, write, edit, list, find, grep, delete) are automatically merged into every chat turn. Overrideworkspaceto add R2 spillover for large files.@cloudflare/shellis now a required peer dependency. -
#1278
8c7caabThanks @threepointone! - Think now owns the inference loop with lifecycle hooks at every stage.Breaking:
onChatMessage(),assembleContext(), andgetMaxSteps()are removed. Use lifecycle hooks and themaxStepsproperty instead. If you need full custom inference, extendAgentdirectly.New lifecycle hooks:
beforeTurn,beforeToolCall,afterToolCall,onStepFinish,onChunk— fire on every turn from all entry paths (WebSocket,chat(),saveMessages, auto-continuation).beforeTurn(ctx)receives the assembled system prompt, messages, tools, and model. Return aTurnConfigto override any part — model, system prompt, messages, tools, activeTools, toolChoice, maxSteps, providerOptions.maxStepsis now a property (default 10) instead of a method. Override per-turn viaTurnConfig.maxSteps.MCP tools auto-merged — no need to manually merge
this.mcp.getAITools()ingetTools().Dynamic context blocks:
Session.addContext()andSession.removeContext()allow adding/removing context blocks after session initialization (e.g., from extensions).Extension manifest expanded with
context(namespaced context block declarations) andhooksfields.