Merged
Conversation
fb22308 to
8695c84
Compare
8695c84 to
8704010
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
@cloudflare/think@0.3.0
Minor Changes
#1340
3cbe776Thanks @threepointone! - Align Think lifecycle hooks with the AI SDK and fix latent bugs around tool-call hooks and extension dispatch.Lifecycle hook context types are now derived from the AI SDK (resolves #1339).
StepContext,ChunkContext,ToolCallContext, andToolCallResultContextare derived fromStepResult,TextStreamPart, andTypedToolCallso users get full typed access toreasoning,sources,files,providerMetadata(where Anthropic cache tokens live),request/response, etc., instead ofunknown. The relevant AI SDK types are re-exported from@cloudflare/think.beforeToolCall/afterToolCallnow fire with correct timing.beforeToolCallruns before the tool'sexecute(Think wraps every tool'sexecute), andafterToolCallruns after withdurationMsand a discriminatedsuccess/output/erroroutcome (backed byexperimental_onToolCallFinish).ToolCallDecisionis now functional. Returning{ action: "block", reason },{ action: "substitute", output }, or{ action: "allow", input }frombeforeToolCallactually intercepts execution.Extension hook dispatch.
ExtensionManifest.hooksclaimed support forbeforeToolCall/afterToolCall/onStepFinish/onChunkbut Think only ever dispatchedbeforeTurn. All five hooks now dispatch to subscribed extensions with JSON-safe snapshots. Extension hook handlers also receive(snapshot, host)(symmetric with toolexecute); previously only tool executes got the host bridge.Breaking renames (per AI SDK conventions):
ToolCallContext.args→input,ToolCallResultContext.args→input,ToolCallResultContext.result→output.afterToolCallis now a discriminated union — readoutputonly whenctx.success === true, anderrorwhenctx.success === false. Equivalent renames onToolCallDecision.See docs/think/lifecycle-hooks.md for the full hook reference.
Patch Changes
3cbe776Thanks @threepointone! - Fix_wrapToolsWithDecisiontoawait originalExecute(...)before checking forSymbol.asyncIterator. The previous code missedPromise<AsyncIterable>returns from plain async functions (async function execute(...) { return makeIter(); }) —Symbol.asyncIterator in promiseis always false, the collapse logic was skipped, and the AI SDK ended up treating the iterator instance itself as the final output value (which the wrapper's own comment warned about). Both sync-returned-iterable and async-returned-iterable cases are now covered, with regression tests for each.agents@0.11.4
Patch Changes
3ebd966Thanks @Muhammad-Bin-Ali! - Add experimental WebMCP adapter (agents/experimental/webmcp) that bridges MCP server tools to Chrome's nativenavigator.modelContextAPI, enabling browser-native AI agents to discover and call tools registered on a Cloudflare McpAgent.@cloudflare/ai-chat@0.4.6
Patch Changes
#1340
3cbe776Thanks @threepointone! -waitForIdleandwaitUntilStablenow also drain in-flight submits that have passed the concurrency decision but haven't yet entered the turn queue (i.e. submits mid-persistMessages). Previously these helpers only awaited_turnQueue.waitForIdle(), which could return while a submit was still tracked in_pendingEnqueueCount— racing with anything that called them (tests, recovery code, callers waiting for quiescence).Fixes a long-standing flake in the
merge concatenates overlapping queued user messages into one follow-up turntest. The test's stream durations are also bumped (10×100ms → 15×150ms) to give the WS dispatch enough headroom under CI load to bump_latestOverlappingSubmitSequencebefore the first turn finishes.