Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

index.ts

123 lines3.4 KB

1// Store contracts + named chat shapes
2export {
3 composePersistence,
4 defineAIPersistence,
5 defineMessageStore,
6 defineActivityStore,
7 defineRunStore,
8 defineInterruptStore,
9 defineMetadataStore,
10 defineGenerationRunStore,
11 defineArtifactStore,
12 defineBlobStore,
13 // Run lifecycle helpers owned by @tanstack/ai, transiting through ./types so
14 // this package's public surface stays a single import for backend authors.
15 isTerminalRunStatus,
16} from './types'
17export type {
18 ActivityRecord,
19 ActivityStore,
20 MessageStore,
21 MessagePage,
22 RunStatus,
23 TerminalRunStatus,
24 RunRecord,
25 RunStore,
26 InterruptCommitEntry,
27 InterruptRecord,
28 InterruptStatus,
29 InterruptStore,
30 MetadataStore,
31 // Named product shapes (prefer these over a sparse bag)
32 ChatTranscriptStores,
33 ChatPersistenceStores,
34 ChatWithInterruptsStores,
35 ChatTranscriptPersistence,
36 ChatPersistence,
37 ChatWithInterruptsPersistence,
38 // Generation run store contract
39 GenerationRunStatus,
40 GenerationRunRecord,
41 GenerationRunStore,
42 // Generation artifact + blob store contracts
43 ArtifactRecord,
44 ArtifactStore,
45 BlobBody,
46 BlobRecord,
47 BlobObject,
48 BlobListPage,
49 BlobPutOptions,
50 BlobGetOptions,
51 BlobRange,
52 BlobListOptions,
53 BlobStore,
54 AIPersistence,
55 AIPersistenceOverrides,
56 ComposedAIPersistenceStores,
57 // Shared conversation identity from @tanstack/ai. Stores key on
58 // Scope.threadId; authorize multi-user access with Scope.userId/tenantId.
59 Scope,
60} from './types'
61export type { PersistenceCompletion } from './capabilities'
62// AIPersistenceStores is intentionally NOT re-exported — use a named chat
63// shape or AIPersistence<{ messages: MessageStore, … }>.
64​
65// Core artifact wire types (re-exported for convenience)
66export type {
67 PersistedArtifactActivity,
68 PersistedArtifactRef,
69 PersistedArtifactRole,
70} from '@tanstack/ai'
71​
72// Middleware (chat state — locks live in @tanstack/ai as withLocks)
73export { withPersistence, withGenerationPersistence } from './middleware'
74export type {
75 WithPersistenceOptions,
76 WithGenerationPersistenceOptions,
77 ArtifactPersistenceOptions,
78 GenerationArtifactDescriptor,
79 GenerationArtifactExtractionInput,
80 GenerationArtifactNameInput,
81} from './middleware'
82​
83// Server helper: rehydrate a thread's messages for a client load
84export { reconstructChat } from './reconstruct'
85export type { ReconstructChatOptions } from './reconstruct'
86​
87// Server helper: rehydrate the last generation job for a client load
88export {
89 reconstructGeneration,
90 getGenerationHydration,
91} from './reconstruct-generation'
92export type {
93 ReconstructedGeneration,
94 ReconstructGenerationOptions,
95 GetGenerationHydrationOptions,
96} from './reconstruct-generation'
97​
98// Server helpers: retrieve a persisted generation artifact + its bytes
99export {
100 retrieveArtifact,
101 retrieveBlob,
102 resolveArtifactBlobKey,
103} from './retrieve'
104​
105// Byte-range helpers: parse a `Range` header (routes), clamp a range to an
106// object's real size (store authors)
107export { parseRangeHeader, resolveBlobRange } from './blob-range'
108​
109// Reference in-memory implementation
110export { memoryPersistence } from './memory'
111​
112// Persistence-owned capabilities only. Locks: @tanstack/ai.
113export {
114 PersistenceCapability,
115 InterruptsCapability,
116 getPersistence,
117 providePersistence,
118 getInterrupts,
119 provideInterrupts,
120 PersistenceCompletionCapability,
121 getPersistenceCompletion,
122 providePersistenceCompletion,
123} from './capabilities'