-
-
Notifications
You must be signed in to change notification settings - Fork 327
fix(ai-client): use threadId as the only client identity #1154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| '@tanstack/ai-client': patch | ||
| '@tanstack/ai-react': patch | ||
| '@tanstack/ai-preact': patch | ||
| '@tanstack/ai-vue': patch | ||
| '@tanstack/ai-solid': patch | ||
| '@tanstack/ai-svelte': patch | ||
| '@tanstack/ai-angular': patch | ||
| --- | ||
|
|
||
| Mint omitted `threadId` after the view mounts, not during render. DevTools binds the hook row to `threadId`. Persistence that is on (`true` or a storage adapter) requires a `threadId` at compile time, and throws at runtime if it is missing. Chat and generation clients no longer accept a separate `id` option. Use `threadId`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Align the runtime behavior with this release note. The Changeset says that missing 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,8 +52,7 @@ Extends `ChatClientOptions` from `@tanstack/ai-client` (minus internal state cal | |
| - `fetcher?` - Direct async function for one-shot generation (alternative to `connection`) | ||
| - `tools?` - Array of client tool implementations (with `.client()` method) | ||
| - `initialMessages?` - Initial messages array | ||
| - `id?` - Unique identifier for this chat instance | ||
| - `threadId?` - Thread ID for AG-UI run correlation. Persists across sends; auto-generated if omitted | ||
| - `threadId?` - The only identity for this chat. Required when persistence is on. If omitted, minted after mount. | ||
| - `forwardedProps?` - Arbitrary client-controlled JSON forwarded to the server in the AG-UI `RunAgentInput.forwardedProps` field. Reactive — accepts a plain value, an Angular `Signal`, or a zero-arg getter; changes sync automatically via `effect` | ||
| - `body?` - **Deprecated.** Use `forwardedProps` instead. Still works for backward compatibility; values are merged into `forwardedProps` on the wire. Reactive (same forms as `forwardedProps`) | ||
| - `context?` - Typed client-local runtime context passed to client tool implementations. Reactive (same forms). This value is not serialized to the server | ||
|
|
@@ -380,7 +379,7 @@ export class CustomGenerationComponent { | |
| } | ||
| ``` | ||
|
|
||
| **Options:** `connection?`, `fetcher?`, `id?`, `body?` (reactive), `devtools?`, `onResult?`, `onError?`, `onProgress?`, `onChunk?` | ||
| **Options:** `connection?`, `fetcher?`, `threadId?`, `body?` (reactive), `devtools?`, `onResult?`, `onError?`, `onProgress?`, `onChunk?` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win Document the generation persistence contract consistently. Both generation option summaries expose
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
| **Returns:** `generate`, `result`, `isLoading`, `error`, `status`, `stop`, `reset`, `runId`. All reactive state is a read-only `Signal<T>`. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Use
minorbumps for this breaking API change.Removing
idand changing the persistence requirement changes the public option shape. This repository usesminorbumps for breaking or shape changes before 1.0. Change each package entry frompatchtominor.Based on learnings: “Breaking changes and breaking/shape changes documented in Changesets must use a
minorversion bump (notmajor).”🤖 Prompt for AI Agents
Source: Learnings