Skip to content

Commit 1b2ac74

Browse files
committed
Add 0.0.0-chat-prerelease-20260520150857 to changelog
1 parent 69cf5b3 commit 1b2ac74

1 file changed

Lines changed: 23 additions & 20 deletions

File tree

docs/ai-chat/changelog.mdx

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebarTitle: "Changelog"
44
description: "Pre-release updates for AI chat agents."
55
---
66

7-
<Update label="May 19, 2026" tags={["SDK"]}>
7+
<Update label="May 19, 2026" description="0.0.0-chat-prerelease-20260520150857" tags={["SDK"]}>
88

99
## Recovery boot — context-preserving continuation after cancel / crash / OOM
1010

@@ -27,8 +27,7 @@ export const myChat = chat.agent({
2727
});
2828
// return nothing → smart default applies
2929
},
30-
run: async ({ messages, signal }) =>
31-
streamText({ model, messages, abortSignal: signal }),
30+
run: async ({ messages, signal }) => streamText({ model, messages, abortSignal: signal }),
3231
});
3332
```
3433

@@ -160,13 +159,13 @@ Hard cutover — there is no compat shim. v4.5 is prerelease.
160159

161160
Customers building human-in-the-loop tools were re-implementing the same accumulator-walking logic to figure out which tool calls were pending, which were resolved, and which results in an incoming wire message were actually new. Lifted into the SDK as five new methods on `chat.history`:
162161

163-
| Method | Description |
164-
|---|---|
165-
| `chat.history.getPendingToolCalls()` | Tool calls on the most recent assistant message in `input-available` state — gates fresh user turns during HITL. |
166-
| `chat.history.getResolvedToolCalls()` | All tool calls in the chain in `output-available` or `output-error` state. |
162+
| Method | Description |
163+
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
164+
| `chat.history.getPendingToolCalls()` | Tool calls on the most recent assistant message in `input-available` state — gates fresh user turns during HITL. |
165+
| `chat.history.getResolvedToolCalls()` | All tool calls in the chain in `output-available` or `output-error` state. |
167166
| `chat.history.extractNewToolResults(message)` | Tool results in `message` whose `toolCallId` is not already resolved on the chain. Most useful in `hydrateMessages` against an incoming wire message, before the runtime merges it. |
168-
| `chat.history.getChain()` | Same as `chat.history.all()` — alias that reads better alongside parent-aware APIs. |
169-
| `chat.history.findMessage(messageId)` | Direct lookup; `undefined` if absent. |
167+
| `chat.history.getChain()` | Same as `chat.history.all()` — alias that reads better alongside parent-aware APIs. |
168+
| `chat.history.findMessage(messageId)` | Direct lookup; `undefined` if absent. |
170169

171170
```ts
172171
// Refuse a regenerate while a tool call is awaiting an answer
@@ -291,7 +290,7 @@ Tool schemas (`description` + `inputSchema`) live in their own module that impor
291290

292291
### Compared to Preload
293292

294-
Preload eagerly triggers the run on page load (good when you're confident the user *will* send a message — trades idle compute for fast TTFC). Head Start gates the run on a real first message — no idle compute, customer's process runs step 1 directly. Pick one per chat.
293+
Preload eagerly triggers the run on page load (good when you're confident the user _will_ send a message — trades idle compute for fast TTFC). Head Start gates the run on a real first message — no idle compute, customer's process runs step 1 directly. Pick one per chat.
295294

296295
### Works on every runtime
297296

@@ -440,17 +439,19 @@ import { myAgent } from "./my-agent";
440439

441440
const harness = mockChatAgent(myAgent, {
442441
chatId: "test-1",
443-
clientData: { model: new MockLanguageModelV3({ /* ... */ }) },
442+
clientData: {
443+
model: new MockLanguageModelV3({
444+
/* ... */
445+
}),
446+
},
444447
});
445448

446449
const turn = await harness.sendMessage({
447450
id: "u1",
448451
role: "user",
449452
parts: [{ type: "text", text: "hi" }],
450453
});
451-
expect(turn.chunks).toContainEqual(
452-
expect.objectContaining({ type: "text-delta", delta: "hello" }),
453-
);
454+
expect(turn.chunks).toContainEqual(expect.objectContaining({ type: "text-delta", delta: "hello" }));
454455
await harness.close();
455456
```
456457

@@ -542,11 +543,11 @@ See [hydrateMessages](/ai-chat/lifecycle-hooks#hydratemessages).
542543
Modify the accumulated message history from any hook or `run()`:
543544

544545
```ts
545-
chat.history.rollbackTo(messageId); // Undo — keep up to this message
546-
chat.history.remove(messageId); // Remove one message
547-
chat.history.replace(id, newMsg); // Edit a message
548-
chat.history.slice(0, -2); // Remove last 2 messages
549-
chat.history.all(); // Read current state
546+
chat.history.rollbackTo(messageId); // Undo — keep up to this message
547+
chat.history.remove(messageId); // Remove one message
548+
chat.history.replace(id, newMsg); // Edit a message
549+
chat.history.slice(0, -2); // Remove last 2 messages
550+
chat.history.all(); // Read current state
550551
```
551552

552553
See [chat.history](/ai-chat/backend#chat-history).
@@ -603,7 +604,9 @@ const sendEmail = tool({
603604
description: "Send an email. Requires human approval.",
604605
inputSchema: z.object({ to: z.string(), subject: z.string(), body: z.string() }),
605606
needsApproval: true,
606-
execute: async ({ to, subject, body }) => { /* ... */ },
607+
execute: async ({ to, subject, body }) => {
608+
/* ... */
609+
},
607610
});
608611
```
609612

0 commit comments

Comments
 (0)