Skip to content

Commit aef678f

Browse files
Version Packages (#1438)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent e7d225b commit aef678f

9 files changed

Lines changed: 78 additions & 25 deletions

File tree

.changeset/clean-facets-tap.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

.changeset/multimodal-workspace-read.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/agents/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# @cloudflare/agents
22

3+
## 0.12.1
4+
5+
### Patch Changes
6+
7+
- [#1443](https://github.com/cloudflare/agents/pull/1443) [`e7d225b`](https://github.com/cloudflare/agents/commit/e7d225b72a743a2cf1491ebf73f06580c668e560) Thanks [@threepointone](https://github.com/threepointone)! - Fix sub-agent WebSockets on deployed Workers by keeping the browser WebSocket owned by the parent Agent and forwarding connect/message/close events to child facets over RPC.
8+
9+
Fix resumed chat streams so a partially hydrated assistant response is rebuilt from replay chunks instead of rendering replayed text as a second assistant text part.
10+
11+
Fix a resume ACK race where drill-in chat connections could miss the terminal stream frame if the helper completed between the resume notification and client acknowledgement.
12+
313
## 0.12.0
414

515
### Minor Changes

packages/agents/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"durable objects"
1010
],
1111
"type": "module",
12-
"version": "0.12.0",
12+
"version": "0.12.1",
1313
"license": "MIT",
1414
"repository": {
1515
"directory": "packages/agents",

packages/ai-chat/CHANGELOG.md

Lines changed: 38 additions & 2 deletions
Large diffs are not rendered by default.

packages/ai-chat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudflare/ai-chat",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"description": "Cloudflare Agents (x) AI SDK Chat",
55
"keywords": [
66
"cloudflare",

packages/think/CHANGELOG.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# @cloudflare/think
22

3+
## 0.5.1
4+
5+
### Patch Changes
6+
7+
- [#1443](https://github.com/cloudflare/agents/pull/1443) [`e7d225b`](https://github.com/cloudflare/agents/commit/e7d225b72a743a2cf1491ebf73f06580c668e560) Thanks [@threepointone](https://github.com/threepointone)! - Fix sub-agent WebSockets on deployed Workers by keeping the browser WebSocket owned by the parent Agent and forwarding connect/message/close events to child facets over RPC.
8+
9+
Fix resumed chat streams so a partially hydrated assistant response is rebuilt from replay chunks instead of rendering replayed text as a second assistant text part.
10+
11+
Fix a resume ACK race where drill-in chat connections could miss the terminal stream frame if the helper completed between the resume notification and client acknowledgement.
12+
13+
- [#1435](https://github.com/cloudflare/agents/pull/1435) [`b197faf`](https://github.com/cloudflare/agents/commit/b197faf0ca79d9e921d2f80c5fcafe4899995d11) Thanks [@threepointone](https://github.com/threepointone)! - Add multimodal-aware workspace reads for images and PDFs while keeping persisted tool results compact.
14+
315
## 0.5.0
416

517
### Minor Changes
@@ -31,14 +43,15 @@
3143

3244
```typescript
3345
const result = await this.saveMessages(messages, {
34-
signal: controller.signal
46+
signal: controller.signal,
3547
});
3648
if (result.status === "aborted") {
3749
// Inference loop terminated mid-stream; partial chunks persisted.
3850
}
3951
```
4052

4153
The signal is linked to Think's per-turn `AbortController` for the duration of the call. When it aborts:
54+
4255
- the inference loop's signal aborts (the same path `chat-request-cancel` takes);
4356
- partial chunks already streamed are persisted to the resumable stream;
4457
- `saveMessages` resolves with `{ status: "aborted" }`;
@@ -51,6 +64,7 @@
5164
`SaveMessagesResult.status` now includes `"aborted"` alongside `"completed"` and `"skipped"`. Existing callers that only switch on `"completed"` are unaffected.
5265

5366
**Limitations.**
67+
5468
- `AbortSignal` cannot cross Durable Object RPC. Construct the controller inside the DO that calls `saveMessages`. To bridge a parent's intent into a child DO, return a `ReadableStream` from the child whose `cancel` callback aborts a per-turn controller — `examples/agents-as-tools` shows the canonical pattern.
5569
- The signal lives in memory only. If the DO hibernates mid-turn and `chatRecovery` is enabled, the recovered turn calls `continueLastTurn()` internally without the original signal — an abort fired after restart has no effect on the recovered turn.
5670

@@ -65,11 +79,13 @@
6579
This extracts the `latest`/`merge`/`drop`/`debounce` admission state machine into a `SubmitConcurrencyController` exported from `agents/chat`. `AIChatAgent` semantics (including merge persistence) are preserved. `Think` now picks up the same pending-enqueue protection, so an overlapping submit is still detected while an accepted request is between admission and turn queue registration.
6680

6781
Additional fixes:
82+
6883
- `Think` now captures the turn generation immediately after admission and threads it into `_turnQueue.enqueue`, so a clear that lands between admission and queue registration cannot run a stale turn.
6984
- Pending-enqueue tracking is now bound to a release function tied to the controller's reset epoch, so a release from a pre-reset submit can no longer erase a post-reset submit's marker and let a third submit slip through as non-overlapping.
7085
- Debounce cancellation correctly resolves all in-flight waiters instead of overwriting a single timer slot.
7186

7287
- [#1394](https://github.com/cloudflare/agents/pull/1394) [`a0a0d17`](https://github.com/cloudflare/agents/commit/a0a0d179a862547715b0dd2e38d37065f24eabe5) Thanks [@threepointone](https://github.com/threepointone)! - think: add `beforeStep` lifecycle hook and `output` passthrough on `TurnConfig`.
88+
7389
- **`beforeStep(ctx)`** — new lifecycle hook called before each AI SDK step in the agentic loop, wired to `streamText({ prepareStep })`. Receives a `PrepareStepContext` (the AI SDK's `PrepareStepFunction` parameter — `steps`, `stepNumber`, `model`, `messages`, `experimental_context`) and may return a `StepConfig` (`PrepareStepResult`) to override `model`, `toolChoice`, `activeTools`, `system`, `messages`, `experimental_context`, or `providerOptions` for the current step. Use `beforeTurn` for turn-wide assembly and `beforeStep` when the decision depends on the step number or previous step results. Resolves [#1363](https://github.com/cloudflare/agents/issues/1363).
7490
- **`TurnConfig.output`** — new optional field on `TurnConfig` forwarded to `streamText`. Accepts the AI SDK's structured-output spec (e.g. `Output.object({ schema })`, `Output.text()`) so a single agent can keep tools enabled on intermediate turns and return schema-validated structured output on a designated turn — without losing tools at model construction. Combine with `activeTools: []` for providers that strip tools when `responseFormat: "json"` is active (e.g. `workers-ai-provider`). Resolves [#1383](https://github.com/cloudflare/agents/issues/1383).
7591
- New re-exports from `@cloudflare/think`: `PrepareStepFunction`, `PrepareStepResult`, `PrepareStepContext`, `StepConfig`.
@@ -167,6 +183,7 @@
167183
### `subAgent()` cross-DO I/O fix
168184

169185
Three issues in the facet initialization path caused `"Cannot perform I/O on behalf of a different Durable Object"` errors when spawning sub-agents in production:
186+
170187
- `subAgent()` constructed a `Request` in the parent DO and passed it to the child via `stub.fetch()`. The `Request` carried native I/O tied to the parent isolate, which the child rejected.
171188
- The facet flag was set _after_ the first `onStart()` ran, so `broadcastMcpServers()` fired with `_isFacet === false` on the initial boot.
172189
- `_broadcastProtocol()`, the inherited `broadcast()`, and `_workflow_broadcast()` iterated the connection registry without an `_isFacet` guard, letting broadcasts reach into the parent DO's WebSocket registry from a child isolate.
@@ -176,12 +193,14 @@
176193
### `"experimental"` compatibility flag no longer required
177194

178195
`ctx.facets`, `ctx.exports`, and `env.LOADER` (Worker Loader) have graduated out of the `"experimental"` compatibility flag in workerd. `agents` and `@cloudflare/think` no longer require it:
196+
179197
- `subAgent()` / `abortSubAgent()` / `deleteSubAgent()` — the `@experimental` JSDoc tag and runtime error messages no longer reference the flag. The runtime guards on `ctx.facets` / `ctx.exports` stay in place and now nudge users toward updating `compatibility_date` instead.
180198
- `Think` — the `@experimental` JSDoc tag no longer references the flag.
181199

182200
No code change is required; remove `"experimental"` from your `compatibility_flags` in `wrangler.jsonc` if it was only there for these features.
183201

184202
- [#1332](https://github.com/cloudflare/agents/pull/1332) [`7cb8acf`](https://github.com/cloudflare/agents/commit/7cb8acff8281a30bc17980e506ab5582f3cb1c72) Thanks [@threepointone](https://github.com/threepointone)! - Expose `createdAt` on fiber and chat recovery contexts so apps can suppress continuations for stale, interrupted turns.
203+
185204
- `FiberRecoveryContext` (from `agents`) gains `createdAt: number` — epoch milliseconds when `runFiber` started, read from the `cf_agents_runs` row that was already tracked internally.
186205
- `ChatRecoveryContext` (from `@cloudflare/ai-chat` and `@cloudflare/think`) gains the same `createdAt` field, threaded through from the underlying fiber.
187206

@@ -247,6 +266,7 @@
247266
- [#1270](https://github.com/cloudflare/agents/pull/1270) [`87b4512`](https://github.com/cloudflare/agents/commit/87b4512985e47de659bf970a65a6d1951f5855fe) Thanks [@threepointone](https://github.com/threepointone)! - Wire Session into Think as the storage layer, achieving full feature parity with AIChatAgent plus Session-backed advantages.
248267

249268
**Think (`@cloudflare/think`):**
269+
250270
- Session integration: `this.messages` backed by `session.getHistory()`, tree-structured messages, context blocks, compaction, FTS5 search
251271
- `configureSession()` override for context blocks, compaction, search, skills (sync or async)
252272
- `assembleContext()` returns `{ system, messages }` with context block composition
@@ -265,10 +285,12 @@
265285
- Constructor wraps `onStart` — subclasses never need `super.onStart()`
266286

267287
**agents (`agents/chat`):**
288+
268289
- Extract `AbortRegistry`, `applyToolUpdate` + builders, `parseProtocolMessage` into shared `agents/chat` layer
269290
- Add `applyChunkToParts` export for fiber recovery
270291

271292
**AIChatAgent (`@cloudflare/ai-chat`):**
293+
272294
- Refactor to use shared `AbortRegistry` from `agents/chat`
273295
- Add `continuation` flag to `OnChatMessageOptions`
274296
- Export `getAgentMessages()` and tool part helpers
@@ -283,6 +305,7 @@
283305
`Think` now extends `Agent` directly (no mixin). Fiber support is inherited from the base class.
284306

285307
**Breaking (experimental APIs only):**
308+
286309
- Removed `withFibers` mixin (`agents/experimental/forever`)
287310
- Removed `withDurableChat` mixin (`@cloudflare/ai-chat/experimental/forever`)
288311
- Removed `./experimental/forever` export from both packages

packages/think/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"tools"
1010
],
1111
"type": "module",
12-
"version": "0.5.0",
12+
"version": "0.5.1",
1313
"license": "MIT",
1414
"repository": {
1515
"directory": "packages/think",

0 commit comments

Comments
 (0)