@tanstack/ai-remix 0.5.5 → 0.6.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.
- package/package.json +4 -4
- package/src/create-chat.ts +9 -0
- package/src/types.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/ai-remix",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Remix 3 bindings for TanStack AI streaming chat, structured outputs, and media generation.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"README.md"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@tanstack/ai-client": "^0.
|
|
50
|
+
"@tanstack/ai-client": "^0.38.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"remix": "^3.0.0-rc.1",
|
|
54
|
-
"@tanstack/ai": "^0.65.
|
|
54
|
+
"@tanstack/ai": "^0.65.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^24.10.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"remix": "^3.0.0-rc.1",
|
|
61
61
|
"vite": "^8.2.1",
|
|
62
62
|
"vitest": "^4.1.10",
|
|
63
|
-
"@tanstack/ai": "0.65.
|
|
63
|
+
"@tanstack/ai": "0.65.1"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"lint:fix": "oxlint src --type-aware --fix",
|
package/src/create-chat.ts
CHANGED
|
@@ -89,6 +89,7 @@ export function createChat<
|
|
|
89
89
|
let isSubscribed = false
|
|
90
90
|
let connectionStatus: ConnectionStatus = 'disconnected'
|
|
91
91
|
let sessionGenerating = false
|
|
92
|
+
let isHydrating = false
|
|
92
93
|
let queue: Array<QueuedMessage> = []
|
|
93
94
|
let runId: string | null = null
|
|
94
95
|
let interruptState: ChatInterruptState<TTools, TInterrupts> = {
|
|
@@ -197,6 +198,10 @@ export function createChat<
|
|
|
197
198
|
sessionGenerating = isGenerating
|
|
198
199
|
commit()
|
|
199
200
|
},
|
|
201
|
+
onHydratingChange: (nextIsHydrating: boolean) => {
|
|
202
|
+
isHydrating = nextIsHydrating
|
|
203
|
+
commit()
|
|
204
|
+
},
|
|
200
205
|
...(options.queue !== undefined && { queue: options.queue }),
|
|
201
206
|
onQueueChange: (nextQueue: Array<QueuedMessage>) => {
|
|
202
207
|
queue = nextQueue
|
|
@@ -219,6 +224,7 @@ export function createChat<
|
|
|
219
224
|
}
|
|
220
225
|
|
|
221
226
|
messages = client.getMessages()
|
|
227
|
+
isHydrating = client.getIsHydrating()
|
|
222
228
|
interruptState = client.getInterruptState()
|
|
223
229
|
runId = client.getCurrentRunId()
|
|
224
230
|
|
|
@@ -413,6 +419,9 @@ export function createChat<
|
|
|
413
419
|
get sessionGenerating() {
|
|
414
420
|
return sessionGenerating
|
|
415
421
|
},
|
|
422
|
+
get isHydrating() {
|
|
423
|
+
return isHydrating
|
|
424
|
+
},
|
|
416
425
|
get queue() {
|
|
417
426
|
return queue
|
|
418
427
|
},
|
package/src/types.ts
CHANGED
|
@@ -100,6 +100,7 @@ export type CreateChatOptions<
|
|
|
100
100
|
| 'onSubscriptionChange'
|
|
101
101
|
| 'onConnectionStatusChange'
|
|
102
102
|
| 'onSessionGeneratingChange'
|
|
103
|
+
| 'onHydratingChange'
|
|
103
104
|
| 'onQueueChange'
|
|
104
105
|
| 'onResumeStateChange'
|
|
105
106
|
| 'onRunIdChange'
|
|
@@ -308,6 +309,14 @@ interface BaseCreateChatReturn<
|
|
|
308
309
|
*/
|
|
309
310
|
sessionGenerating: boolean
|
|
310
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Whether the chat is being rebuilt from persistence (the server hydrate, or
|
|
314
|
+
* an async storage adapter). While it is true, show a loading state instead
|
|
315
|
+
* of an empty chat. It turns false when the transcript is in place and any
|
|
316
|
+
* in-flight run is re-joined. From then on `isLoading` covers the stream.
|
|
317
|
+
*/
|
|
318
|
+
isHydrating: boolean
|
|
319
|
+
|
|
311
320
|
/**
|
|
312
321
|
* Set messages manually
|
|
313
322
|
*/
|