Skip to content

Version Packages#1338

Merged
threepointone merged 1 commit intomainfrom
changeset-release/main
Apr 18, 2026
Merged

Version Packages#1338
threepointone merged 1 commit intomainfrom
changeset-release/main

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 18, 2026

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 3cbe776 Thanks @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, and ToolCallResultContext are derived from StepResult, TextStreamPart, and TypedToolCall so users get full typed access to reasoning, sources, files, providerMetadata (where Anthropic cache tokens live), request/response, etc., instead of unknown. The relevant AI SDK types are re-exported from @cloudflare/think.

    beforeToolCall / afterToolCall now fire with correct timing. beforeToolCall runs before the tool's execute (Think wraps every tool's execute), and afterToolCall runs after with durationMs and a discriminated success/output/error outcome (backed by experimental_onToolCallFinish).

    ToolCallDecision is now functional. Returning { action: "block", reason }, { action: "substitute", output }, or { action: "allow", input } from beforeToolCall actually intercepts execution.

    Extension hook dispatch. ExtensionManifest.hooks claimed support for beforeToolCall/afterToolCall/onStepFinish/onChunk but Think only ever dispatched beforeTurn. All five hooks now dispatch to subscribed extensions with JSON-safe snapshots. Extension hook handlers also receive (snapshot, host) (symmetric with tool execute); previously only tool executes got the host bridge.

    Breaking renames (per AI SDK conventions): ToolCallContext.argsinput, ToolCallResultContext.argsinput, ToolCallResultContext.resultoutput. afterToolCall is now a discriminated union — read output only when ctx.success === true, and error when ctx.success === false. Equivalent renames on ToolCallDecision.

    See docs/think/lifecycle-hooks.md for the full hook reference.

Patch Changes

  • #1340 3cbe776 Thanks @threepointone! - Fix _wrapToolsWithDecision to await originalExecute(...) before checking for Symbol.asyncIterator. The previous code missed Promise<AsyncIterable> returns from plain async functions (async function execute(...) { return makeIter(); }) — Symbol.asyncIterator in promise is 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

  • #1222 3ebd966 Thanks @Muhammad-Bin-Ali! - Add experimental WebMCP adapter (agents/experimental/webmcp) that bridges MCP server tools to Chrome's native navigator.modelContext API, enabling browser-native AI agents to discover and call tools registered on a Cloudflare McpAgent.

@cloudflare/ai-chat@0.4.6

Patch Changes

  • #1340 3cbe776 Thanks @threepointone! - waitForIdle and waitUntilStable now 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 turn test. The test's stream durations are also bumped (10×100ms → 15×150ms) to give the WS dispatch enough headroom under CI load to bump _latestOverlappingSubmitSequence before the first turn finishes.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@github-actions github-actions bot force-pushed the changeset-release/main branch 3 times, most recently from fb22308 to 8695c84 Compare April 18, 2026 21:39
@github-actions github-actions bot force-pushed the changeset-release/main branch from 8695c84 to 8704010 Compare April 18, 2026 23:30
@threepointone threepointone merged commit 3dd0ab5 into main Apr 18, 2026
@threepointone threepointone deleted the changeset-release/main branch April 18, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quality of live improvements for Think

1 participant