@tanstack/ai-svelte 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,6 +56,7 @@ export function createChat(options) {
56
56
  id: clientId,
57
57
  initialMessages: options.initialMessages,
58
58
  body: options.body,
59
+ forwardedProps: options.forwardedProps,
59
60
  onResponse: options.onResponse,
60
61
  onChunk: (chunk) => {
61
62
  if (options.outputSchema !== undefined) {
@@ -142,9 +143,16 @@ export function createChat(options) {
142
143
  const addToolApprovalResponse = async (response) => {
143
144
  await client.addToolApprovalResponse(response);
144
145
  };
146
+ /**
147
+ * @deprecated Use `updateForwardedProps` instead.
148
+ * Both populate the same wire payload.
149
+ */
145
150
  const updateBody = (newBody) => {
146
151
  client.updateOptions({ body: newBody });
147
152
  };
153
+ const updateForwardedProps = (newForwardedProps) => {
154
+ client.updateOptions({ forwardedProps: newForwardedProps });
155
+ };
148
156
  // Return the chat interface with reactive getters
149
157
  // Using getters allows Svelte to track reactivity without needing $ prefix
150
158
  return {
@@ -184,5 +192,6 @@ export function createChat(options) {
184
192
  addToolResult,
185
193
  addToolApprovalResponse,
186
194
  updateBody,
195
+ updateForwardedProps,
187
196
  };
188
197
  }
package/dist/types.d.ts CHANGED
@@ -131,7 +131,13 @@ interface BaseCreateChatReturn<TTools extends ReadonlyArray<AnyClientTool> = any
131
131
  */
132
132
  readonly sessionGenerating: boolean;
133
133
  /**
134
- * Update the body sent with requests (e.g., for changing model selection)
134
+ * @deprecated Use `updateForwardedProps` instead. Both populate the
135
+ * same wire payload; `updateBody` is retained for backward compatibility.
135
136
  */
136
137
  updateBody: (body: Record<string, any>) => void;
138
+ /**
139
+ * Update the AG-UI `forwardedProps` sent with requests (e.g., for
140
+ * changing model selection or other client-driven options).
141
+ */
142
+ updateForwardedProps: (forwardedProps: Record<string, any>) => void;
137
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/ai-svelte",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Svelte bindings for TanStack AI",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -33,11 +33,11 @@
33
33
  "streaming"
34
34
  ],
35
35
  "dependencies": {
36
- "@tanstack/ai-client": "0.9.2"
36
+ "@tanstack/ai-client": "0.10.0"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "svelte": "^5.0.0",
40
- "@tanstack/ai": "^0.17.0"
40
+ "@tanstack/ai": "^0.18.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@standard-schema/spec": "^1.1.0",
@@ -50,7 +50,7 @@
50
50
  "svelte-check": "^4.2.0",
51
51
  "typescript": "5.9.3",
52
52
  "vite": "^7.2.7",
53
- "@tanstack/ai": "0.17.0"
53
+ "@tanstack/ai": "0.18.0"
54
54
  },
55
55
  "scripts": {
56
56
  "clean": "rm -rf ./dist",
@@ -85,6 +85,7 @@ export function createChat<
85
85
  id: clientId,
86
86
  initialMessages: options.initialMessages,
87
87
  body: options.body,
88
+ forwardedProps: options.forwardedProps,
88
89
  onResponse: options.onResponse,
89
90
  onChunk: (chunk: StreamChunk) => {
90
91
  if (options.outputSchema !== undefined) {
@@ -191,10 +192,18 @@ export function createChat<
191
192
  await client.addToolApprovalResponse(response)
192
193
  }
193
194
 
195
+ /**
196
+ * @deprecated Use `updateForwardedProps` instead.
197
+ * Both populate the same wire payload.
198
+ */
194
199
  const updateBody = (newBody: Record<string, any>) => {
195
200
  client.updateOptions({ body: newBody })
196
201
  }
197
202
 
203
+ const updateForwardedProps = (newForwardedProps: Record<string, any>) => {
204
+ client.updateOptions({ forwardedProps: newForwardedProps })
205
+ }
206
+
198
207
  // Return the chat interface with reactive getters
199
208
  // Using getters allows Svelte to track reactivity without needing $ prefix
200
209
  return {
@@ -234,5 +243,6 @@ export function createChat<
234
243
  addToolResult,
235
244
  addToolApprovalResponse,
236
245
  updateBody,
246
+ updateForwardedProps,
237
247
  } as unknown as CreateChatReturn<TTools, TSchema>
238
248
  }
package/src/types.ts CHANGED
@@ -183,9 +183,15 @@ interface BaseCreateChatReturn<
183
183
  */
184
184
  readonly sessionGenerating: boolean
185
185
  /**
186
- * Update the body sent with requests (e.g., for changing model selection)
186
+ * @deprecated Use `updateForwardedProps` instead. Both populate the
187
+ * same wire payload; `updateBody` is retained for backward compatibility.
187
188
  */
188
189
  updateBody: (body: Record<string, any>) => void
190
+ /**
191
+ * Update the AG-UI `forwardedProps` sent with requests (e.g., for
192
+ * changing model selection or other client-driven options).
193
+ */
194
+ updateForwardedProps: (forwardedProps: Record<string, any>) => void
189
195
  }
190
196
 
191
197
  // Note: createChatClientOptions and InferChatMessages are now in @tanstack/ai-client