Open History to see the last commit
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 { retrieveArtifact, retrieveBlob } from './retrieve'
100
101// Byte-range helpers: parse a `Range` header (routes), clamp a range to an
102// object's real size (store authors)
103export { parseRangeHeader, resolveBlobRange } from './blob-range'
104
105// Reference in-memory implementation
106export { memoryPersistence } from './memory'
107
108// Persistence-owned capabilities only. Locks: @tanstack/ai.
109export {
110 PersistenceCapability,
111 InterruptsCapability,
112 getPersistence,
113 providePersistence,
114 getInterrupts,
115 provideInterrupts,
116 PersistenceCompletionCapability,
117 getPersistenceCompletion,
118 providePersistenceCompletion,
119} from './capabilities'