@tanstack/ai-svelte 0.10.8 → 0.10.9

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.
@@ -51,8 +51,11 @@ export function createChat(options) {
51
51
  // rather than `field?: T | undefined`. Under `exactOptionalPropertyTypes`,
52
52
  // passing an explicit `undefined` for an absent-only optional is a type
53
53
  // error, so we omit the key when the caller's value is undefined.
54
+ const transport = options.connection
55
+ ? { connection: options.connection }
56
+ : { fetcher: options.fetcher };
54
57
  const client = new ChatClient({
55
- connection: options.connection,
58
+ ...transport,
56
59
  id: clientId,
57
60
  ...(options.initialMessages !== undefined && {
58
61
  initialMessages: options.initialMessages,
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AnyClientTool, InferSchemaType, ModelMessage, SchemaInput } from '@tanstack/ai';
2
- import type { ChatClientOptions, ChatClientState, ChatRequestBody, ConnectionStatus, MultimodalContent, UIMessage } from '@tanstack/ai-client';
2
+ import type { ChatClientOptions, ChatClientState, ChatRequestBody, ConnectionStatus, DistributedOmit, MultimodalContent, UIMessage } from '@tanstack/ai-client';
3
3
  export type { ChatRequestBody, MultimodalContent, UIMessage };
4
4
  /**
5
5
  * Recursive partial — every property and every nested array element is
@@ -30,7 +30,7 @@ export type DeepPartial<T> = T extends ReadonlyArray<infer U> ? Array<DeepPartia
30
30
  * Note: Connection and body changes will recreate the ChatClient instance.
31
31
  * To update these options, remount the component or use a key prop.
32
32
  */
33
- export type CreateChatOptions<TTools extends ReadonlyArray<AnyClientTool> = any, TSchema extends SchemaInput | undefined = undefined> = Omit<ChatClientOptions<TTools>, 'onMessagesChange' | 'onLoadingChange' | 'onErrorChange' | 'onStatusChange' | 'onSubscriptionChange' | 'onConnectionStatusChange' | 'onSessionGeneratingChange'> & {
33
+ export type CreateChatOptions<TTools extends ReadonlyArray<AnyClientTool> = any, TSchema extends SchemaInput | undefined = undefined> = DistributedOmit<ChatClientOptions<TTools>, 'onMessagesChange' | 'onLoadingChange' | 'onErrorChange' | 'onStatusChange' | 'onSubscriptionChange' | 'onConnectionStatusChange' | 'onSessionGeneratingChange'> & {
34
34
  live?: boolean;
35
35
  /**
36
36
  * Standard-schema-compatible schema (Zod, Valibot, ArkType, or plain JSON
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@tanstack/ai-svelte",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "Svelte 5 bindings for TanStack AI streaming chat, structured outputs, and media generation.",
5
5
  "author": "",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/TanStack/ai.git",
10
- "directory": "packages/typescript/ai-svelte"
10
+ "directory": "packages/ai-svelte"
11
11
  },
12
12
  "type": "module",
13
13
  "svelte": "./dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "media-generation"
39
39
  ],
40
40
  "dependencies": {
41
- "@tanstack/ai-client": "0.11.8"
41
+ "@tanstack/ai-client": "0.12.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "svelte": "^5.0.0",
@@ -86,8 +86,12 @@ export function createChat<
86
86
  // rather than `field?: T | undefined`. Under `exactOptionalPropertyTypes`,
87
87
  // passing an explicit `undefined` for an absent-only optional is a type
88
88
  // error, so we omit the key when the caller's value is undefined.
89
+ const transport = options.connection
90
+ ? { connection: options.connection }
91
+ : { fetcher: options.fetcher }
92
+
89
93
  const client = new ChatClient({
90
- connection: options.connection,
94
+ ...transport,
91
95
  id: clientId,
92
96
  ...(options.initialMessages !== undefined && {
93
97
  initialMessages: options.initialMessages,
package/src/types.ts CHANGED
@@ -9,6 +9,7 @@ import type {
9
9
  ChatClientState,
10
10
  ChatRequestBody,
11
11
  ConnectionStatus,
12
+ DistributedOmit,
12
13
  MultimodalContent,
13
14
  UIMessage,
14
15
  } from '@tanstack/ai-client'
@@ -52,7 +53,7 @@ export type DeepPartial<T> =
52
53
  export type CreateChatOptions<
53
54
  TTools extends ReadonlyArray<AnyClientTool> = any,
54
55
  TSchema extends SchemaInput | undefined = undefined,
55
- > = Omit<
56
+ > = DistributedOmit<
56
57
  ChatClientOptions<TTools>,
57
58
  | 'onMessagesChange'
58
59
  | 'onLoadingChange'