@witqq/agent-sdk 0.7.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.
Files changed (154) hide show
  1. package/dist/{types-CqvUAYxt.d.ts → agent-C6H2CgJA.d.cts} +139 -102
  2. package/dist/{types-CqvUAYxt.d.cts → agent-F7oB6eKp.d.ts} +139 -102
  3. package/dist/auth/index.cjs +72 -1
  4. package/dist/auth/index.cjs.map +1 -1
  5. package/dist/auth/index.d.cts +21 -154
  6. package/dist/auth/index.d.ts +21 -154
  7. package/dist/auth/index.js +72 -1
  8. package/dist/auth/index.js.map +1 -1
  9. package/dist/backends/claude.cjs +480 -261
  10. package/dist/backends/claude.cjs.map +1 -1
  11. package/dist/backends/claude.d.cts +3 -1
  12. package/dist/backends/claude.d.ts +3 -1
  13. package/dist/backends/claude.js +480 -261
  14. package/dist/backends/claude.js.map +1 -1
  15. package/dist/backends/copilot.cjs +337 -112
  16. package/dist/backends/copilot.cjs.map +1 -1
  17. package/dist/backends/copilot.d.cts +12 -4
  18. package/dist/backends/copilot.d.ts +12 -4
  19. package/dist/backends/copilot.js +337 -112
  20. package/dist/backends/copilot.js.map +1 -1
  21. package/dist/backends/mock-llm.cjs +719 -0
  22. package/dist/backends/mock-llm.cjs.map +1 -0
  23. package/dist/backends/mock-llm.d.cts +37 -0
  24. package/dist/backends/mock-llm.d.ts +37 -0
  25. package/dist/backends/mock-llm.js +717 -0
  26. package/dist/backends/mock-llm.js.map +1 -0
  27. package/dist/backends/vercel-ai.cjs +301 -61
  28. package/dist/backends/vercel-ai.cjs.map +1 -1
  29. package/dist/backends/vercel-ai.d.cts +3 -1
  30. package/dist/backends/vercel-ai.d.ts +3 -1
  31. package/dist/backends/vercel-ai.js +301 -61
  32. package/dist/backends/vercel-ai.js.map +1 -1
  33. package/dist/backends-Cno0gZjy.d.cts +114 -0
  34. package/dist/backends-Cno0gZjy.d.ts +114 -0
  35. package/dist/chat/accumulator.cjs +1 -1
  36. package/dist/chat/accumulator.cjs.map +1 -1
  37. package/dist/chat/accumulator.d.cts +5 -2
  38. package/dist/chat/accumulator.d.ts +5 -2
  39. package/dist/chat/accumulator.js +1 -1
  40. package/dist/chat/accumulator.js.map +1 -1
  41. package/dist/chat/backends.cjs +1084 -821
  42. package/dist/chat/backends.cjs.map +1 -1
  43. package/dist/chat/backends.d.cts +10 -6
  44. package/dist/chat/backends.d.ts +10 -6
  45. package/dist/chat/backends.js +1082 -800
  46. package/dist/chat/backends.js.map +1 -1
  47. package/dist/chat/context.cjs +50 -0
  48. package/dist/chat/context.cjs.map +1 -1
  49. package/dist/chat/context.d.cts +27 -3
  50. package/dist/chat/context.d.ts +27 -3
  51. package/dist/chat/context.js +50 -0
  52. package/dist/chat/context.js.map +1 -1
  53. package/dist/chat/core.cjs +60 -27
  54. package/dist/chat/core.cjs.map +1 -1
  55. package/dist/chat/core.d.cts +41 -382
  56. package/dist/chat/core.d.ts +41 -382
  57. package/dist/chat/core.js +58 -28
  58. package/dist/chat/core.js.map +1 -1
  59. package/dist/chat/errors.cjs +48 -26
  60. package/dist/chat/errors.cjs.map +1 -1
  61. package/dist/chat/errors.d.cts +6 -31
  62. package/dist/chat/errors.d.ts +6 -31
  63. package/dist/chat/errors.js +48 -25
  64. package/dist/chat/errors.js.map +1 -1
  65. package/dist/chat/events.cjs.map +1 -1
  66. package/dist/chat/events.d.cts +6 -2
  67. package/dist/chat/events.d.ts +6 -2
  68. package/dist/chat/events.js.map +1 -1
  69. package/dist/chat/index.cjs +1612 -1125
  70. package/dist/chat/index.cjs.map +1 -1
  71. package/dist/chat/index.d.cts +35 -10
  72. package/dist/chat/index.d.ts +35 -10
  73. package/dist/chat/index.js +1600 -1097
  74. package/dist/chat/index.js.map +1 -1
  75. package/dist/chat/react/theme.css +2517 -0
  76. package/dist/chat/react.cjs +2212 -1158
  77. package/dist/chat/react.cjs.map +1 -1
  78. package/dist/chat/react.d.cts +665 -122
  79. package/dist/chat/react.d.ts +665 -122
  80. package/dist/chat/react.js +2191 -1156
  81. package/dist/chat/react.js.map +1 -1
  82. package/dist/chat/runtime.cjs +405 -186
  83. package/dist/chat/runtime.cjs.map +1 -1
  84. package/dist/chat/runtime.d.cts +92 -28
  85. package/dist/chat/runtime.d.ts +92 -28
  86. package/dist/chat/runtime.js +405 -186
  87. package/dist/chat/runtime.js.map +1 -1
  88. package/dist/chat/server.cjs +2247 -212
  89. package/dist/chat/server.cjs.map +1 -1
  90. package/dist/chat/server.d.cts +451 -90
  91. package/dist/chat/server.d.ts +451 -90
  92. package/dist/chat/server.js +2234 -213
  93. package/dist/chat/server.js.map +1 -1
  94. package/dist/chat/sessions.cjs +64 -66
  95. package/dist/chat/sessions.cjs.map +1 -1
  96. package/dist/chat/sessions.d.cts +37 -118
  97. package/dist/chat/sessions.d.ts +37 -118
  98. package/dist/chat/sessions.js +65 -67
  99. package/dist/chat/sessions.js.map +1 -1
  100. package/dist/chat/sqlite.cjs +536 -0
  101. package/dist/chat/sqlite.cjs.map +1 -0
  102. package/dist/chat/sqlite.d.cts +164 -0
  103. package/dist/chat/sqlite.d.ts +164 -0
  104. package/dist/chat/sqlite.js +527 -0
  105. package/dist/chat/sqlite.js.map +1 -0
  106. package/dist/chat/state.cjs +14 -1
  107. package/dist/chat/state.cjs.map +1 -1
  108. package/dist/chat/state.d.cts +5 -2
  109. package/dist/chat/state.d.ts +5 -2
  110. package/dist/chat/state.js +14 -1
  111. package/dist/chat/state.js.map +1 -1
  112. package/dist/chat/storage.cjs +58 -33
  113. package/dist/chat/storage.cjs.map +1 -1
  114. package/dist/chat/storage.d.cts +18 -8
  115. package/dist/chat/storage.d.ts +18 -8
  116. package/dist/chat/storage.js +59 -34
  117. package/dist/chat/storage.js.map +1 -1
  118. package/dist/errors-C-so0M4t.d.cts +33 -0
  119. package/dist/errors-C-so0M4t.d.ts +33 -0
  120. package/dist/errors-CmVvczxZ.d.cts +28 -0
  121. package/dist/errors-CmVvczxZ.d.ts +28 -0
  122. package/dist/{in-process-transport-C2oPTYs6.d.ts → in-process-transport-7EIit9Xk.d.ts} +72 -33
  123. package/dist/{in-process-transport-DG-w5G6k.d.cts → in-process-transport-Ct9YcX8I.d.cts} +72 -33
  124. package/dist/index.cjs +354 -60
  125. package/dist/index.cjs.map +1 -1
  126. package/dist/index.d.cts +294 -123
  127. package/dist/index.d.ts +294 -123
  128. package/dist/index.js +347 -60
  129. package/dist/index.js.map +1 -1
  130. package/dist/provider-types-PTSlRPNB.d.cts +39 -0
  131. package/dist/provider-types-PTSlRPNB.d.ts +39 -0
  132. package/dist/refresh-manager-B81PpYBr.d.cts +153 -0
  133. package/dist/refresh-manager-Dlv_iNZi.d.ts +153 -0
  134. package/dist/testing.cjs +1107 -0
  135. package/dist/testing.cjs.map +1 -0
  136. package/dist/testing.d.cts +144 -0
  137. package/dist/testing.d.ts +144 -0
  138. package/dist/testing.js +1101 -0
  139. package/dist/testing.js.map +1 -0
  140. package/dist/token-store-CSUBgYwn.d.ts +48 -0
  141. package/dist/token-store-CuC4hB9Z.d.cts +48 -0
  142. package/dist/{transport-DX1Nhm4N.d.cts → transport-DLWCN18G.d.cts} +5 -4
  143. package/dist/{transport-D1OaUgRk.d.ts → transport-DsuS-GeM.d.ts} +5 -4
  144. package/dist/{types-CGF7AEX1.d.cts → types-4vbcmPTp.d.cts} +4 -2
  145. package/dist/{types-Bh5AhqD-.d.ts → types-BxggH0Yh.d.ts} +4 -2
  146. package/dist/types-DgtI1hzh.d.ts +364 -0
  147. package/dist/types-DkSXALKg.d.cts +364 -0
  148. package/package.json +41 -5
  149. package/LICENSE +0 -21
  150. package/README.md +0 -948
  151. package/dist/errors-BDLbNu9w.d.cts +0 -13
  152. package/dist/errors-BDLbNu9w.d.ts +0 -13
  153. package/dist/types-DLZzlJxt.d.ts +0 -39
  154. package/dist/types-tE0CXwBl.d.cts +0 -39
@@ -0,0 +1,364 @@
1
+ import { M as ModelInfo, F as FullAgentConfig, I as IAgentService, T as ToolDefinition, U as UsageData } from './agent-F7oB6eKp.js';
2
+ import { E as ErrorCode } from './errors-C-so0M4t.js';
3
+ import { A as AuthToken } from './types-BxggH0Yh.js';
4
+
5
+ /**
6
+ * @witqq/agent-sdk/chat/backends/types
7
+ *
8
+ * IChatBackend — core backend interface for sending/streaming messages.
9
+ * IResumableBackend — extends IChatBackend with session resume support.
10
+ */
11
+
12
+ /** Options for creating a backend adapter */
13
+ interface BackendAdapterOptions {
14
+ /** Agent configuration (model, systemPrompt, tools, etc.) */
15
+ agentConfig: FullAgentConfig;
16
+ /** Pre-created agent service (if adapter should not own lifecycle) */
17
+ agentService?: IAgentService;
18
+ /** Factory for lazy service creation (called on first use, not at construction) */
19
+ agentServiceFactory?: () => IAgentService;
20
+ }
21
+ /**
22
+ * Core chat backend — send, stream, models, validate, dispose.
23
+ * All backends implement this. Resume support is optional.
24
+ *
25
+ * Note: `agentService` is intentionally NOT on this interface.
26
+ * It's an implementation detail exposed on BaseBackendAdapter for
27
+ * advanced consumers who need direct service access.
28
+ */
29
+ interface IChatBackend {
30
+ /** Backend name (e.g. "copilot", "claude", "vercel-ai") */
31
+ readonly name: string;
32
+ /** Send a message and receive a complete response */
33
+ sendMessage(session: ChatSession, message: string, options?: SendMessageOptions): Promise<ChatMessage>;
34
+ /** Stream a message response as ChatEvents */
35
+ streamMessage(session: ChatSession, message: string, options?: SendMessageOptions): AsyncIterable<ChatEvent>;
36
+ /** List available models */
37
+ listModels(): Promise<ModelInfo[]>;
38
+ /** Validate backend configuration/credentials */
39
+ validate(): Promise<{
40
+ valid: boolean;
41
+ errors: string[];
42
+ }>;
43
+ /** Dispose resources */
44
+ dispose(): Promise<void>;
45
+ /** Current effective model */
46
+ readonly currentModel: string | undefined;
47
+ }
48
+ /**
49
+ * Extended backend with session resume capabilities.
50
+ * Only backends with persistent sessions (Copilot, Claude) implement this.
51
+ * Use `isResumableBackend()` to type-narrow at runtime.
52
+ */
53
+ interface IResumableBackend extends IChatBackend {
54
+ /** Whether this adapter supports session resume */
55
+ canResume(): boolean;
56
+ /**
57
+ * Resume a previous session by its backend session ID.
58
+ * Streams events from the resumed session.
59
+ * @throws ChatError with SESSION_EXPIRED if session is no longer valid
60
+ * @throws ChatError with SESSION_NOT_FOUND if session ID is unknown
61
+ */
62
+ resume(session: ChatSession, backendSessionId: string, options?: SendMessageOptions): AsyncIterable<ChatEvent>;
63
+ /** The backend session ID from the last stream, or null if not yet streamed */
64
+ readonly backendSessionId: string | null;
65
+ }
66
+ /** Type guard: checks if a backend adapter supports session resume */
67
+ declare function isResumableBackend(adapter: IChatBackend): adapter is IResumableBackend;
68
+
69
+ /** Branded type for unique identifiers */
70
+ type ChatId = string & {
71
+ readonly __brand: "ChatId";
72
+ };
73
+ /**
74
+ * Generate a new unique ChatId (crypto.randomUUID-based)
75
+ * @returns Branded ChatId string
76
+ */
77
+ declare function createChatId(): ChatId;
78
+ /**
79
+ * Cast a string to ChatId with UUID format validation.
80
+ * Use this instead of manual `as ChatId` type assertions.
81
+ *
82
+ * @param value - String to validate and cast
83
+ * @returns Branded ChatId
84
+ * @throws {TypeError} If value is not a valid UUID v4 format
85
+ */
86
+ declare function toChatId(value: string): ChatId;
87
+ /**
88
+ * Accepts either a plain string or branded ChatId for API convenience.
89
+ * Use this in public API signatures so consumers don't need `as ChatId` casts.
90
+ */
91
+ type ChatIdLike = string | ChatId;
92
+ /** Lifecycle status of a message part (text, reasoning, etc.) */
93
+ type PartStatus = "pending" | "streaming" | "complete" | "error";
94
+ /** Lifecycle status of a tool call within a message */
95
+ type ToolCallStatus = "pending" | "running" | "requires_approval" | "complete" | "error" | "denied";
96
+ /** Lifecycle status of an entire message */
97
+ type MessageStatus = "pending" | "streaming" | "complete" | "error" | "cancelled";
98
+ /** Lifecycle status of a chat session */
99
+ type SessionStatus = "active";
100
+ /** Lifecycle status of the chat runtime */
101
+ type RuntimeStatus = "idle" | "streaming" | "error" | "disposed";
102
+ /** Plain text content part */
103
+ interface TextPart {
104
+ type: "text";
105
+ text: string;
106
+ status: PartStatus;
107
+ }
108
+ /** Model reasoning/thinking content part */
109
+ interface ReasoningPart {
110
+ type: "reasoning";
111
+ text: string;
112
+ status: PartStatus;
113
+ }
114
+ /** Tool invocation part with call ID, arguments, optional result */
115
+ interface ToolCallPart {
116
+ type: "tool_call";
117
+ toolCallId: string;
118
+ name: string;
119
+ args: unknown;
120
+ result?: unknown;
121
+ status: ToolCallStatus;
122
+ error?: string;
123
+ }
124
+ /** Source reference part (URL citation) */
125
+ interface SourcePart {
126
+ type: "source";
127
+ url: string;
128
+ title?: string;
129
+ status: PartStatus;
130
+ }
131
+ /** File attachment part (base64-encoded data) */
132
+ interface FilePart {
133
+ type: "file";
134
+ name: string;
135
+ mimeType: string;
136
+ data: string;
137
+ status: PartStatus;
138
+ }
139
+ /** Union of all message part types */
140
+ type MessagePart = TextPart | ReasoningPart | ToolCallPart | SourcePart | FilePart;
141
+ /** Role of message author */
142
+ type ChatRole = "user" | "assistant" | "system";
143
+ /** Metadata attached to messages — useful preset for the TMetadata generic */
144
+ interface ChatMessageMetadata {
145
+ model?: string;
146
+ backend?: string;
147
+ usage?: UsageData;
148
+ isSummary?: boolean;
149
+ estimatedTokens?: number;
150
+ custom?: Record<string, unknown>;
151
+ }
152
+ /** Message status */
153
+ type ChatMessageStatus = MessageStatus;
154
+ /** A single chat message — the fundamental unit of conversation */
155
+ interface ChatMessage<TMetadata = unknown> {
156
+ id: ChatId;
157
+ role: ChatRole;
158
+ parts: MessagePart[];
159
+ metadata?: TMetadata;
160
+ createdAt: string;
161
+ updatedAt?: string;
162
+ status: MessageStatus;
163
+ }
164
+ /** Session configuration snapshot */
165
+ interface ChatSessionConfig {
166
+ model: string;
167
+ backend: string;
168
+ systemPrompt?: string;
169
+ temperature?: number;
170
+ maxTokens?: number;
171
+ }
172
+ /**
173
+ * Session metadata tracking usage statistics and custom extensions.
174
+ *
175
+ * Updated automatically by session stores on each `addMessage()` call.
176
+ * The generic `TCustom` parameter allows type-safe application-specific
177
+ * metadata via the `custom` field.
178
+ *
179
+ * @typeParam TCustom - Shape of the `custom` field (defaults to `Record<string, unknown>`)
180
+ */
181
+ interface ChatSessionMetadata<TCustom extends Record<string, unknown> = Record<string, unknown>> {
182
+ /** Number of messages in the session (updated by session store) */
183
+ messageCount: number;
184
+ /** Total token count across all messages in the session */
185
+ totalTokens: number;
186
+ /** Optional tags for session categorization and filtering */
187
+ tags?: string[];
188
+ /** Application-specific metadata — typed via the TCustom generic parameter */
189
+ custom?: TCustom;
190
+ }
191
+ /** Chat session — a conversation with ordered messages (pure serializable data) */
192
+ interface ChatSession<TCustom extends Record<string, unknown> = Record<string, unknown>> {
193
+ id: ChatId;
194
+ title?: string;
195
+ messages: ChatMessage[];
196
+ config: ChatSessionConfig;
197
+ metadata: ChatSessionMetadata<TCustom>;
198
+ status: SessionStatus;
199
+ createdAt: string;
200
+ updatedAt: string;
201
+ backendSessionId?: string;
202
+ }
203
+ /**
204
+ * Reactive wrapper around ChatSession — provides subscribe/getSnapshot for
205
+ * React useSyncExternalStore integration and lastMessage convenience getter.
206
+ * Session stores may optionally return ObservableSession instances.
207
+ */
208
+ interface ObservableSession<TCustom extends Record<string, unknown> = Record<string, unknown>> extends ChatSession<TCustom> {
209
+ /** Subscribe to session changes (for React useSyncExternalStore) */
210
+ subscribe(callback: () => void): () => void;
211
+ /** Get immutable snapshot of session state (for React useSyncExternalStore) */
212
+ getSnapshot(): ChatSession<TCustom>;
213
+ /** Last message in the session */
214
+ readonly lastMessage: ChatMessage | undefined;
215
+ }
216
+ /** Lightweight session info for listing (without full message array) */
217
+ interface SessionInfo {
218
+ id: ChatId;
219
+ title?: string;
220
+ status: SessionStatus;
221
+ messageCount: number;
222
+ lastMessage?: ChatMessage;
223
+ createdAt: string;
224
+ updatedAt: string;
225
+ }
226
+ /** Events emitted during chat operation */
227
+ type ChatEvent = {
228
+ type: "message:start";
229
+ messageId: ChatId;
230
+ role: ChatRole;
231
+ } | {
232
+ type: "message:delta";
233
+ messageId: ChatId;
234
+ text: string;
235
+ } | {
236
+ type: "message:complete";
237
+ messageId: ChatId;
238
+ message: ChatMessage;
239
+ } | {
240
+ type: "tool:start";
241
+ messageId: ChatId;
242
+ toolCallId: string;
243
+ toolName: string;
244
+ args: Record<string, unknown>;
245
+ } | {
246
+ type: "tool:complete";
247
+ messageId: ChatId;
248
+ toolCallId: string;
249
+ toolName: string;
250
+ result: unknown;
251
+ isError?: boolean;
252
+ } | {
253
+ type: "thinking:start";
254
+ messageId: ChatId;
255
+ } | {
256
+ type: "thinking:delta";
257
+ messageId: ChatId;
258
+ text: string;
259
+ } | {
260
+ type: "thinking:end";
261
+ messageId: ChatId;
262
+ } | {
263
+ type: "permission:request";
264
+ messageId: ChatId;
265
+ toolName: string;
266
+ toolArgs: Record<string, unknown>;
267
+ } | {
268
+ type: "permission:response";
269
+ messageId: ChatId;
270
+ toolName: string;
271
+ allowed: boolean;
272
+ } | {
273
+ type: "usage";
274
+ promptTokens: number;
275
+ completionTokens: number;
276
+ model?: string;
277
+ } | {
278
+ type: "session:created";
279
+ sessionId: ChatId;
280
+ } | {
281
+ type: "session:updated";
282
+ sessionId: ChatId;
283
+ } | {
284
+ type: "error";
285
+ error: string;
286
+ recoverable: boolean;
287
+ code?: ErrorCode;
288
+ messageId?: ChatId;
289
+ } | {
290
+ type: "typing:start";
291
+ } | {
292
+ type: "typing:end";
293
+ } | {
294
+ type: "heartbeat";
295
+ } | {
296
+ type: "done";
297
+ finalOutput?: string;
298
+ finishReason?: string;
299
+ };
300
+ /** All possible ChatEvent type strings */
301
+ type ChatEventType = ChatEvent["type"];
302
+ /** Context passed to ChatMiddleware hooks */
303
+ interface ChatMiddlewareContext {
304
+ sessionId: ChatId;
305
+ signal: AbortSignal;
306
+ }
307
+ /** Runtime-level middleware for the send/receive lifecycle.
308
+ * Different from EventMiddleware which operates at the event bus level. */
309
+ interface ChatMiddleware {
310
+ /** Transform message before sending to backend. Return null to reject the send. */
311
+ onBeforeSend?(message: ChatMessage, context: ChatMiddlewareContext): ChatMessage | null | Promise<ChatMessage | null>;
312
+ /** Transform/intercept stream events */
313
+ onEvent?(event: ChatEvent, context: ChatMiddlewareContext): ChatEvent | null | Promise<ChatEvent | null>;
314
+ /** Transform completed message after receiving from backend */
315
+ onAfterReceive?(message: ChatMessage, context: ChatMiddlewareContext): ChatMessage | Promise<ChatMessage>;
316
+ /** Intercept errors — return null to suppress, return error to propagate */
317
+ onError?(error: Error, context: ChatMiddlewareContext): Error | null | Promise<Error | null>;
318
+ }
319
+ /** Options for sending a message to a provider */
320
+ interface SendMessageOptions {
321
+ signal?: AbortSignal;
322
+ /** Model to use for this request. Required for server-side runtime.send(). */
323
+ model?: string;
324
+ /** Per-call system prompt override (forwarded to the backend agent) */
325
+ systemPrompt?: string;
326
+ context?: Record<string, unknown>;
327
+ /** Additional tools to include in this request */
328
+ tools?: ToolDefinition[];
329
+ }
330
+ /** Options for runtime.send() — requires backend routing info */
331
+ interface RuntimeSendOptions {
332
+ /** Backend to route this request to (key in backends map) */
333
+ backend: string;
334
+ /** Authentication credentials for the backend factory */
335
+ credentials: AuthToken;
336
+ /** Model to use for this request */
337
+ model: string;
338
+ /** Per-call system prompt override (forwarded to the backend agent) */
339
+ systemPrompt?: string;
340
+ /** Abort signal */
341
+ signal?: AbortSignal;
342
+ /** Request-scoped context */
343
+ context?: Record<string, unknown>;
344
+ /** Additional tools */
345
+ tools?: ToolDefinition[];
346
+ }
347
+ /**
348
+ * @deprecated IChatProvider has been inlined into IChatBackend.
349
+ * Import IChatBackend from "@witqq/agent-sdk/chat/backends" instead.
350
+ * Kept as type alias for backward compatibility.
351
+ */
352
+ type IChatProvider = IChatBackend;
353
+ /**
354
+ * Create a simple text ChatMessage.
355
+ *
356
+ * @param text - Message text content
357
+ * @param role - Message role (default: "user")
358
+ * @returns A complete ChatMessage with a single TextPart
359
+ */
360
+ declare function createTextMessage(text: string, role?: ChatRole): ChatMessage;
361
+ /** Type guard: checks if a session has reactive API (subscribe/getSnapshot) */
362
+ declare function isObservableSession<TCustom extends Record<string, unknown> = Record<string, unknown>>(session: ChatSession<TCustom>): session is ObservableSession<TCustom>;
363
+
364
+ export { type ChatSessionMetadata as A, type BackendAdapterOptions as B, type ChatEventType as C, type FilePart as F, type IChatBackend as I, type MessageStatus as M, type ObservableSession as O, type PartStatus as P, type RuntimeStatus as R, type SendMessageOptions as S, type ToolCallStatus as T, type ChatEvent as a, type ChatId as b, type ChatMessage as c, type IResumableBackend as d, type ChatMiddleware as e, type ChatIdLike as f, type ChatSession as g, type RuntimeSendOptions as h, isResumableBackend as i, type ChatSessionConfig as j, type ChatMessageMetadata as k, type ChatMessageStatus as l, type ChatMiddlewareContext as m, type ChatRole as n, type IChatProvider as o, type MessagePart as p, type ReasoningPart as q, type SessionInfo as r, type SessionStatus as s, type SourcePart as t, type TextPart as u, type ToolCallPart as v, createChatId as w, createTextMessage as x, isObservableSession as y, toChatId as z };