@sqlrooms/ai-config 0.26.0-rc.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/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright 2025 Ilya Boyandin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ A central configuration and type definitions package that maintains base DuckDB configuration schemas and Zod schema definitions for SQLRooms. It provides TypeScript types and interfaces along with essential constants and utilities used for managing DuckDB state.
2
+
3
+ ## Features
4
+
5
+ - 📝 **DuckDB Configuration**: Define and manage room DuckDB configuration schemas.
6
+ - 🔍 **Type Safety**: Strong TypeScript typing for DuckDB configuration objects.
7
+ - ✅ **Validation**: Zod schemas for runtime validation of DuckDB configurations.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @sqlrooms/duckdb-config
13
+ # or
14
+ yarn add @sqlrooms/duckdb-config
15
+ ```
16
+
17
+ ## Basic Usage
18
+
19
+ ### Working with DuckDB Configuration
20
+
21
+ ```tsx
22
+ import {
23
+ DuckDbSliceConfig,
24
+ createDefaultDuckDbConfig,
25
+ } from '@sqlrooms/duckdb-config';
26
+
27
+ // Create a new DuckDB configuration
28
+ const duckDbConfig: DuckDbSliceConfig = createDefaultDuckDbConfig();
29
+
30
+ // This is then used as part of a bigger room configuration.
31
+ // The `RoomConfig` for a room is typically a composition of slice configurations.
32
+ // For example:
33
+ //
34
+ // import {SqlEditorSliceConfig} from '@sqlrooms/sql-editor-config';
35
+ //
36
+ // type RoomConfig = DuckDbSliceConfig & SqlEditorSliceConfig;
37
+ ```
38
+
39
+ ## Advanced Features
40
+
41
+ - **Schema Extensions**: Extend base schemas for custom room types
42
+ - **Configuration Validation**: Validate configurations at runtime
43
+ - **Serialization**: Convert configurations to/from JSON for storage
44
+
45
+ For more information, visit the SQLRooms documentation.
46
+
47
+ ```
48
+
49
+ ```
@@ -0,0 +1,85 @@
1
+ import { z } from 'zod';
2
+ export declare const AiSettingsSliceConfig: z.ZodObject<{
3
+ providers: z.ZodRecord<z.ZodString, z.ZodObject<{
4
+ baseUrl: z.ZodString;
5
+ apiKey: z.ZodString;
6
+ models: z.ZodArray<z.ZodObject<{
7
+ modelName: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ modelName: string;
10
+ }, {
11
+ modelName: string;
12
+ }>, "many">;
13
+ }, "strip", z.ZodTypeAny, {
14
+ baseUrl: string;
15
+ apiKey: string;
16
+ models: {
17
+ modelName: string;
18
+ }[];
19
+ }, {
20
+ baseUrl: string;
21
+ apiKey: string;
22
+ models: {
23
+ modelName: string;
24
+ }[];
25
+ }>>;
26
+ customModels: z.ZodArray<z.ZodObject<{
27
+ baseUrl: z.ZodString;
28
+ apiKey: z.ZodString;
29
+ modelName: z.ZodString;
30
+ }, "strip", z.ZodTypeAny, {
31
+ baseUrl: string;
32
+ apiKey: string;
33
+ modelName: string;
34
+ }, {
35
+ baseUrl: string;
36
+ apiKey: string;
37
+ modelName: string;
38
+ }>, "many">;
39
+ modelParameters: z.ZodObject<{
40
+ maxSteps: z.ZodNumber;
41
+ additionalInstruction: z.ZodString;
42
+ }, "strip", z.ZodTypeAny, {
43
+ maxSteps: number;
44
+ additionalInstruction: string;
45
+ }, {
46
+ maxSteps: number;
47
+ additionalInstruction: string;
48
+ }>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ providers: Record<string, {
51
+ baseUrl: string;
52
+ apiKey: string;
53
+ models: {
54
+ modelName: string;
55
+ }[];
56
+ }>;
57
+ customModels: {
58
+ baseUrl: string;
59
+ apiKey: string;
60
+ modelName: string;
61
+ }[];
62
+ modelParameters: {
63
+ maxSteps: number;
64
+ additionalInstruction: string;
65
+ };
66
+ }, {
67
+ providers: Record<string, {
68
+ baseUrl: string;
69
+ apiKey: string;
70
+ models: {
71
+ modelName: string;
72
+ }[];
73
+ }>;
74
+ customModels: {
75
+ baseUrl: string;
76
+ apiKey: string;
77
+ modelName: string;
78
+ }[];
79
+ modelParameters: {
80
+ maxSteps: number;
81
+ additionalInstruction: string;
82
+ };
83
+ }>;
84
+ export type AiSettingsSliceConfig = z.infer<typeof AiSettingsSliceConfig>;
85
+ //# sourceMappingURL=AiSettingsSliceConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSettingsSliceConfig.d.ts","sourceRoot":"","sources":["../src/AiSettingsSliceConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBhC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ export const AiSettingsSliceConfig = z.object({
3
+ providers: z.record(z.string(), // provider name
4
+ z.object({
5
+ baseUrl: z.string(),
6
+ apiKey: z.string(),
7
+ models: z.array(z.object({
8
+ modelName: z.string(),
9
+ })),
10
+ })),
11
+ // custom models using provider 'custom'
12
+ customModels: z.array(z.object({
13
+ baseUrl: z.string(),
14
+ apiKey: z.string(),
15
+ modelName: z.string(),
16
+ })),
17
+ modelParameters: z.object({
18
+ maxSteps: z.number(),
19
+ additionalInstruction: z.string(),
20
+ }),
21
+ });
22
+ //# sourceMappingURL=AiSettingsSliceConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSettingsSliceConfig.js","sourceRoot":"","sources":["../src/AiSettingsSliceConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,SAAS,EAAE,CAAC,CAAC,MAAM,CACjB,CAAC,CAAC,MAAM,EAAE,EAAE,gBAAgB;IAC5B,CAAC,CAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,MAAM,EAAE,CAAC,CAAC,KAAK,CACb,CAAC,CAAC,MAAM,CAAC;YACP,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;SACtB,CAAC,CACH;KACF,CAAC,CACH;IACD,wCAAwC;IACxC,YAAY,EAAE,CAAC,CAAC,KAAK,CACnB,CAAC,CAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC,CACH;IACD,eAAe,EAAE,CAAC,CAAC,MAAM,CAAC;QACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE;KAClC,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\n\nexport const AiSettingsSliceConfig = z.object({\n providers: z.record(\n z.string(), // provider name\n z.object({\n baseUrl: z.string(),\n apiKey: z.string(),\n models: z.array(\n z.object({\n modelName: z.string(),\n }),\n ),\n }),\n ),\n // custom models using provider 'custom'\n customModels: z.array(\n z.object({\n baseUrl: z.string(),\n apiKey: z.string(),\n modelName: z.string(),\n }),\n ),\n modelParameters: z.object({\n maxSteps: z.number(),\n additionalInstruction: z.string(),\n }),\n});\n\nexport type AiSettingsSliceConfig = z.infer<typeof AiSettingsSliceConfig>;\n"]}
@@ -0,0 +1,347 @@
1
+ import { z } from 'zod';
2
+ export declare const AiSliceConfig: z.ZodObject<{
3
+ sessions: z.ZodArray<z.ZodEffects<z.ZodObject<{
4
+ id: z.ZodString;
5
+ name: z.ZodString;
6
+ modelProvider: z.ZodString;
7
+ model: z.ZodString;
8
+ customModelName: z.ZodOptional<z.ZodString>;
9
+ baseUrl: z.ZodOptional<z.ZodString>;
10
+ analysisResults: z.ZodArray<z.ZodObject<{
11
+ id: z.ZodString;
12
+ prompt: z.ZodString;
13
+ streamMessage: z.ZodEffects<z.ZodObject<{
14
+ parts: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
15
+ type: z.ZodLiteral<"text">;
16
+ text: z.ZodString;
17
+ additionalData: z.ZodOptional<z.ZodAny>;
18
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ type: "text";
21
+ text: string;
22
+ isCompleted?: boolean | undefined;
23
+ additionalData?: any;
24
+ }, {
25
+ type: "text";
26
+ text: string;
27
+ isCompleted?: boolean | undefined;
28
+ additionalData?: any;
29
+ }>, z.ZodObject<{
30
+ type: z.ZodLiteral<"tool-invocation">;
31
+ toolInvocation: z.ZodObject<{
32
+ toolCallId: z.ZodString;
33
+ toolName: z.ZodString;
34
+ args: z.ZodAny;
35
+ state: z.ZodString;
36
+ result: z.ZodOptional<z.ZodAny>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ toolName: string;
39
+ toolCallId: string;
40
+ state: string;
41
+ args?: any;
42
+ result?: any;
43
+ }, {
44
+ toolName: string;
45
+ toolCallId: string;
46
+ state: string;
47
+ args?: any;
48
+ result?: any;
49
+ }>;
50
+ additionalData: z.ZodOptional<z.ZodAny>;
51
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ type: "tool-invocation";
54
+ toolInvocation: {
55
+ toolName: string;
56
+ toolCallId: string;
57
+ state: string;
58
+ args?: any;
59
+ result?: any;
60
+ };
61
+ isCompleted?: boolean | undefined;
62
+ additionalData?: any;
63
+ }, {
64
+ type: "tool-invocation";
65
+ toolInvocation: {
66
+ toolName: string;
67
+ toolCallId: string;
68
+ state: string;
69
+ args?: any;
70
+ result?: any;
71
+ };
72
+ isCompleted?: boolean | undefined;
73
+ additionalData?: any;
74
+ }>, z.ZodObject<{
75
+ type: z.ZodString;
76
+ additionalData: z.ZodOptional<z.ZodAny>;
77
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
78
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
79
+ type: z.ZodString;
80
+ additionalData: z.ZodOptional<z.ZodAny>;
81
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
82
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
83
+ type: z.ZodString;
84
+ additionalData: z.ZodOptional<z.ZodAny>;
85
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
86
+ }, z.ZodTypeAny, "passthrough">>]>, "many">>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ parts?: ({
89
+ type: "text";
90
+ text: string;
91
+ isCompleted?: boolean | undefined;
92
+ additionalData?: any;
93
+ } | {
94
+ type: "tool-invocation";
95
+ toolInvocation: {
96
+ toolName: string;
97
+ toolCallId: string;
98
+ state: string;
99
+ args?: any;
100
+ result?: any;
101
+ };
102
+ isCompleted?: boolean | undefined;
103
+ additionalData?: any;
104
+ } | z.objectOutputType<{
105
+ type: z.ZodString;
106
+ additionalData: z.ZodOptional<z.ZodAny>;
107
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
108
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
109
+ }, {
110
+ parts?: ({
111
+ type: "text";
112
+ text: string;
113
+ isCompleted?: boolean | undefined;
114
+ additionalData?: any;
115
+ } | {
116
+ type: "tool-invocation";
117
+ toolInvocation: {
118
+ toolName: string;
119
+ toolCallId: string;
120
+ state: string;
121
+ args?: any;
122
+ result?: any;
123
+ };
124
+ isCompleted?: boolean | undefined;
125
+ additionalData?: any;
126
+ } | z.objectInputType<{
127
+ type: z.ZodString;
128
+ additionalData: z.ZodOptional<z.ZodAny>;
129
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
130
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
131
+ }>, {
132
+ parts?: ({
133
+ type: "text";
134
+ text: string;
135
+ isCompleted?: boolean | undefined;
136
+ additionalData?: any;
137
+ } | {
138
+ type: "tool-invocation";
139
+ toolInvocation: {
140
+ toolName: string;
141
+ toolCallId: string;
142
+ state: string;
143
+ args?: any;
144
+ result?: any;
145
+ };
146
+ isCompleted?: boolean | undefined;
147
+ additionalData?: any;
148
+ } | z.objectOutputType<{
149
+ type: z.ZodString;
150
+ additionalData: z.ZodOptional<z.ZodAny>;
151
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
152
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
153
+ }, unknown>;
154
+ errorMessage: z.ZodOptional<z.ZodObject<{
155
+ error: z.ZodString;
156
+ }, "strip", z.ZodTypeAny, {
157
+ error: string;
158
+ }, {
159
+ error: string;
160
+ }>>;
161
+ isCompleted: z.ZodBoolean;
162
+ }, "strip", z.ZodTypeAny, {
163
+ isCompleted: boolean;
164
+ id: string;
165
+ prompt: string;
166
+ streamMessage: {
167
+ parts?: ({
168
+ type: "text";
169
+ text: string;
170
+ isCompleted?: boolean | undefined;
171
+ additionalData?: any;
172
+ } | {
173
+ type: "tool-invocation";
174
+ toolInvocation: {
175
+ toolName: string;
176
+ toolCallId: string;
177
+ state: string;
178
+ args?: any;
179
+ result?: any;
180
+ };
181
+ isCompleted?: boolean | undefined;
182
+ additionalData?: any;
183
+ } | z.objectOutputType<{
184
+ type: z.ZodString;
185
+ additionalData: z.ZodOptional<z.ZodAny>;
186
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
187
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
188
+ };
189
+ errorMessage?: {
190
+ error: string;
191
+ } | undefined;
192
+ }, {
193
+ isCompleted: boolean;
194
+ id: string;
195
+ prompt: string;
196
+ streamMessage?: unknown;
197
+ errorMessage?: {
198
+ error: string;
199
+ } | undefined;
200
+ }>, "many">;
201
+ createdAt: z.ZodOptional<z.ZodDate>;
202
+ }, "strip", z.ZodTypeAny, {
203
+ id: string;
204
+ name: string;
205
+ modelProvider: string;
206
+ model: string;
207
+ analysisResults: {
208
+ isCompleted: boolean;
209
+ id: string;
210
+ prompt: string;
211
+ streamMessage: {
212
+ parts?: ({
213
+ type: "text";
214
+ text: string;
215
+ isCompleted?: boolean | undefined;
216
+ additionalData?: any;
217
+ } | {
218
+ type: "tool-invocation";
219
+ toolInvocation: {
220
+ toolName: string;
221
+ toolCallId: string;
222
+ state: string;
223
+ args?: any;
224
+ result?: any;
225
+ };
226
+ isCompleted?: boolean | undefined;
227
+ additionalData?: any;
228
+ } | z.objectOutputType<{
229
+ type: z.ZodString;
230
+ additionalData: z.ZodOptional<z.ZodAny>;
231
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
232
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
233
+ };
234
+ errorMessage?: {
235
+ error: string;
236
+ } | undefined;
237
+ }[];
238
+ baseUrl?: string | undefined;
239
+ customModelName?: string | undefined;
240
+ createdAt?: Date | undefined;
241
+ }, {
242
+ id: string;
243
+ name: string;
244
+ modelProvider: string;
245
+ model: string;
246
+ analysisResults: {
247
+ isCompleted: boolean;
248
+ id: string;
249
+ prompt: string;
250
+ streamMessage?: unknown;
251
+ errorMessage?: {
252
+ error: string;
253
+ } | undefined;
254
+ }[];
255
+ baseUrl?: string | undefined;
256
+ customModelName?: string | undefined;
257
+ createdAt?: Date | undefined;
258
+ }>, {
259
+ id: string;
260
+ name: string;
261
+ modelProvider: string;
262
+ model: string;
263
+ analysisResults: {
264
+ isCompleted: boolean;
265
+ id: string;
266
+ prompt: string;
267
+ streamMessage: {
268
+ parts?: ({
269
+ type: "text";
270
+ text: string;
271
+ isCompleted?: boolean | undefined;
272
+ additionalData?: any;
273
+ } | {
274
+ type: "tool-invocation";
275
+ toolInvocation: {
276
+ toolName: string;
277
+ toolCallId: string;
278
+ state: string;
279
+ args?: any;
280
+ result?: any;
281
+ };
282
+ isCompleted?: boolean | undefined;
283
+ additionalData?: any;
284
+ } | z.objectOutputType<{
285
+ type: z.ZodString;
286
+ additionalData: z.ZodOptional<z.ZodAny>;
287
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
288
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
289
+ };
290
+ errorMessage?: {
291
+ error: string;
292
+ } | undefined;
293
+ }[];
294
+ baseUrl?: string | undefined;
295
+ customModelName?: string | undefined;
296
+ createdAt?: Date | undefined;
297
+ }, unknown>, "many">;
298
+ currentSessionId: z.ZodOptional<z.ZodString>;
299
+ }, "strip", z.ZodTypeAny, {
300
+ sessions: {
301
+ id: string;
302
+ name: string;
303
+ modelProvider: string;
304
+ model: string;
305
+ analysisResults: {
306
+ isCompleted: boolean;
307
+ id: string;
308
+ prompt: string;
309
+ streamMessage: {
310
+ parts?: ({
311
+ type: "text";
312
+ text: string;
313
+ isCompleted?: boolean | undefined;
314
+ additionalData?: any;
315
+ } | {
316
+ type: "tool-invocation";
317
+ toolInvocation: {
318
+ toolName: string;
319
+ toolCallId: string;
320
+ state: string;
321
+ args?: any;
322
+ result?: any;
323
+ };
324
+ isCompleted?: boolean | undefined;
325
+ additionalData?: any;
326
+ } | z.objectOutputType<{
327
+ type: z.ZodString;
328
+ additionalData: z.ZodOptional<z.ZodAny>;
329
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
330
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
331
+ };
332
+ errorMessage?: {
333
+ error: string;
334
+ } | undefined;
335
+ }[];
336
+ baseUrl?: string | undefined;
337
+ customModelName?: string | undefined;
338
+ createdAt?: Date | undefined;
339
+ }[];
340
+ currentSessionId?: string | undefined;
341
+ }, {
342
+ sessions: unknown[];
343
+ currentSessionId?: string | undefined;
344
+ }>;
345
+ export type AiSliceConfig = z.infer<typeof AiSliceConfig>;
346
+ export declare function createDefaultAiConfig(props?: Partial<AiSliceConfig>): AiSliceConfig;
347
+ //# sourceMappingURL=AiSliceConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSliceConfig.d.ts","sourceRoot":"","sources":["../src/AiSliceConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAyB6kG,CAAC;8BAAqB,CAAC;;;;;4BAAyG,CAAC;8BAAqB,CAAC;;;;;;;;;;4BAAkR,CAAC;8BAAqB,CAAC;;;;;;;;;;4BAAgO,CAAC;8BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAA9Q,CAAC;8BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;4BAAgO,CAAC;8BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;4BAA9Q,CAAC;8BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAvB,CAAC;8BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAvB,CAAC;8BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAvB,CAAC;8BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAvB,CAAC;8BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;EAtBriH,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,wBAAgB,qBAAqB,CACnC,KAAK,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC7B,aAAa,CAgBf"}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ import { AnalysisSessionSchema } from './AnalysisSessionSchema';
3
+ import { createId } from '@paralleldrive/cuid2';
4
+ export const AiSliceConfig = z.object({
5
+ sessions: z.array(AnalysisSessionSchema),
6
+ currentSessionId: z.string().optional(),
7
+ });
8
+ export function createDefaultAiConfig(props) {
9
+ const defaultSessionId = createId();
10
+ return {
11
+ sessions: [
12
+ {
13
+ id: defaultSessionId,
14
+ name: 'Default Session',
15
+ modelProvider: 'openai',
16
+ model: 'gpt-4.1',
17
+ analysisResults: [],
18
+ createdAt: new Date(),
19
+ },
20
+ ],
21
+ currentSessionId: defaultSessionId,
22
+ ...props,
23
+ };
24
+ }
25
+ //# sourceMappingURL=AiSliceConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiSliceConfig.js","sourceRoot":"","sources":["../src/AiSliceConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;IACxC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAGH,MAAM,UAAU,qBAAqB,CACnC,KAA8B;IAE9B,MAAM,gBAAgB,GAAG,QAAQ,EAAE,CAAC;IACpC,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,EAAE,EAAE,gBAAgB;gBACpB,IAAI,EAAE,iBAAiB;gBACvB,aAAa,EAAE,QAAQ;gBACvB,KAAK,EAAE,SAAS;gBAChB,eAAe,EAAE,EAAE;gBACnB,SAAS,EAAE,IAAI,IAAI,EAAE;aACtB;SACF;QACD,gBAAgB,EAAE,gBAAgB;QAClC,GAAG,KAAK;KACT,CAAC;AACJ,CAAC","sourcesContent":["import {z} from 'zod';\nimport {AnalysisSessionSchema} from './AnalysisSessionSchema';\nimport {createId} from '@paralleldrive/cuid2';\n\nexport const AiSliceConfig = z.object({\n sessions: z.array(AnalysisSessionSchema),\n currentSessionId: z.string().optional(),\n});\nexport type AiSliceConfig = z.infer<typeof AiSliceConfig>;\n\nexport function createDefaultAiConfig(\n props?: Partial<AiSliceConfig>,\n): AiSliceConfig {\n const defaultSessionId = createId();\n return {\n sessions: [\n {\n id: defaultSessionId,\n name: 'Default Session',\n modelProvider: 'openai',\n model: 'gpt-4.1',\n analysisResults: [],\n createdAt: new Date(),\n },\n ],\n currentSessionId: defaultSessionId,\n ...props,\n };\n}\n"]}
@@ -0,0 +1,498 @@
1
+ import { z } from 'zod';
2
+ export declare const ErrorMessageSchema: z.ZodObject<{
3
+ error: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ error: string;
6
+ }, {
7
+ error: string;
8
+ }>;
9
+ export type ErrorMessageSchema = z.infer<typeof ErrorMessageSchema>;
10
+ export declare const AnalysisResultSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ prompt: z.ZodString;
13
+ streamMessage: z.ZodEffects<z.ZodObject<{
14
+ parts: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
15
+ type: z.ZodLiteral<"text">;
16
+ text: z.ZodString;
17
+ additionalData: z.ZodOptional<z.ZodAny>;
18
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ type: "text";
21
+ text: string;
22
+ isCompleted?: boolean | undefined;
23
+ additionalData?: any;
24
+ }, {
25
+ type: "text";
26
+ text: string;
27
+ isCompleted?: boolean | undefined;
28
+ additionalData?: any;
29
+ }>, z.ZodObject<{
30
+ type: z.ZodLiteral<"tool-invocation">;
31
+ toolInvocation: z.ZodObject<{
32
+ toolCallId: z.ZodString;
33
+ toolName: z.ZodString;
34
+ args: z.ZodAny;
35
+ state: z.ZodString;
36
+ result: z.ZodOptional<z.ZodAny>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ toolName: string;
39
+ toolCallId: string;
40
+ state: string;
41
+ args?: any;
42
+ result?: any;
43
+ }, {
44
+ toolName: string;
45
+ toolCallId: string;
46
+ state: string;
47
+ args?: any;
48
+ result?: any;
49
+ }>;
50
+ additionalData: z.ZodOptional<z.ZodAny>;
51
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ type: "tool-invocation";
54
+ toolInvocation: {
55
+ toolName: string;
56
+ toolCallId: string;
57
+ state: string;
58
+ args?: any;
59
+ result?: any;
60
+ };
61
+ isCompleted?: boolean | undefined;
62
+ additionalData?: any;
63
+ }, {
64
+ type: "tool-invocation";
65
+ toolInvocation: {
66
+ toolName: string;
67
+ toolCallId: string;
68
+ state: string;
69
+ args?: any;
70
+ result?: any;
71
+ };
72
+ isCompleted?: boolean | undefined;
73
+ additionalData?: any;
74
+ }>, z.ZodObject<{
75
+ type: z.ZodString;
76
+ additionalData: z.ZodOptional<z.ZodAny>;
77
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
78
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
79
+ type: z.ZodString;
80
+ additionalData: z.ZodOptional<z.ZodAny>;
81
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
82
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
83
+ type: z.ZodString;
84
+ additionalData: z.ZodOptional<z.ZodAny>;
85
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
86
+ }, z.ZodTypeAny, "passthrough">>]>, "many">>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ parts?: ({
89
+ type: "text";
90
+ text: string;
91
+ isCompleted?: boolean | undefined;
92
+ additionalData?: any;
93
+ } | {
94
+ type: "tool-invocation";
95
+ toolInvocation: {
96
+ toolName: string;
97
+ toolCallId: string;
98
+ state: string;
99
+ args?: any;
100
+ result?: any;
101
+ };
102
+ isCompleted?: boolean | undefined;
103
+ additionalData?: any;
104
+ } | z.objectOutputType<{
105
+ type: z.ZodString;
106
+ additionalData: z.ZodOptional<z.ZodAny>;
107
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
108
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
109
+ }, {
110
+ parts?: ({
111
+ type: "text";
112
+ text: string;
113
+ isCompleted?: boolean | undefined;
114
+ additionalData?: any;
115
+ } | {
116
+ type: "tool-invocation";
117
+ toolInvocation: {
118
+ toolName: string;
119
+ toolCallId: string;
120
+ state: string;
121
+ args?: any;
122
+ result?: any;
123
+ };
124
+ isCompleted?: boolean | undefined;
125
+ additionalData?: any;
126
+ } | z.objectInputType<{
127
+ type: z.ZodString;
128
+ additionalData: z.ZodOptional<z.ZodAny>;
129
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
130
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
131
+ }>, {
132
+ parts?: ({
133
+ type: "text";
134
+ text: string;
135
+ isCompleted?: boolean | undefined;
136
+ additionalData?: any;
137
+ } | {
138
+ type: "tool-invocation";
139
+ toolInvocation: {
140
+ toolName: string;
141
+ toolCallId: string;
142
+ state: string;
143
+ args?: any;
144
+ result?: any;
145
+ };
146
+ isCompleted?: boolean | undefined;
147
+ additionalData?: any;
148
+ } | z.objectOutputType<{
149
+ type: z.ZodString;
150
+ additionalData: z.ZodOptional<z.ZodAny>;
151
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
152
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
153
+ }, unknown>;
154
+ errorMessage: z.ZodOptional<z.ZodObject<{
155
+ error: z.ZodString;
156
+ }, "strip", z.ZodTypeAny, {
157
+ error: string;
158
+ }, {
159
+ error: string;
160
+ }>>;
161
+ isCompleted: z.ZodBoolean;
162
+ }, "strip", z.ZodTypeAny, {
163
+ isCompleted: boolean;
164
+ id: string;
165
+ prompt: string;
166
+ streamMessage: {
167
+ parts?: ({
168
+ type: "text";
169
+ text: string;
170
+ isCompleted?: boolean | undefined;
171
+ additionalData?: any;
172
+ } | {
173
+ type: "tool-invocation";
174
+ toolInvocation: {
175
+ toolName: string;
176
+ toolCallId: string;
177
+ state: string;
178
+ args?: any;
179
+ result?: any;
180
+ };
181
+ isCompleted?: boolean | undefined;
182
+ additionalData?: any;
183
+ } | z.objectOutputType<{
184
+ type: z.ZodString;
185
+ additionalData: z.ZodOptional<z.ZodAny>;
186
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
187
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
188
+ };
189
+ errorMessage?: {
190
+ error: string;
191
+ } | undefined;
192
+ }, {
193
+ isCompleted: boolean;
194
+ id: string;
195
+ prompt: string;
196
+ streamMessage?: unknown;
197
+ errorMessage?: {
198
+ error: string;
199
+ } | undefined;
200
+ }>;
201
+ export type AnalysisResultSchema = z.infer<typeof AnalysisResultSchema>;
202
+ export declare const AnalysisSessionSchema: z.ZodEffects<z.ZodObject<{
203
+ id: z.ZodString;
204
+ name: z.ZodString;
205
+ modelProvider: z.ZodString;
206
+ model: z.ZodString;
207
+ customModelName: z.ZodOptional<z.ZodString>;
208
+ baseUrl: z.ZodOptional<z.ZodString>;
209
+ analysisResults: z.ZodArray<z.ZodObject<{
210
+ id: z.ZodString;
211
+ prompt: z.ZodString;
212
+ streamMessage: z.ZodEffects<z.ZodObject<{
213
+ parts: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
214
+ type: z.ZodLiteral<"text">;
215
+ text: z.ZodString;
216
+ additionalData: z.ZodOptional<z.ZodAny>;
217
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
218
+ }, "strip", z.ZodTypeAny, {
219
+ type: "text";
220
+ text: string;
221
+ isCompleted?: boolean | undefined;
222
+ additionalData?: any;
223
+ }, {
224
+ type: "text";
225
+ text: string;
226
+ isCompleted?: boolean | undefined;
227
+ additionalData?: any;
228
+ }>, z.ZodObject<{
229
+ type: z.ZodLiteral<"tool-invocation">;
230
+ toolInvocation: z.ZodObject<{
231
+ toolCallId: z.ZodString;
232
+ toolName: z.ZodString;
233
+ args: z.ZodAny;
234
+ state: z.ZodString;
235
+ result: z.ZodOptional<z.ZodAny>;
236
+ }, "strip", z.ZodTypeAny, {
237
+ toolName: string;
238
+ toolCallId: string;
239
+ state: string;
240
+ args?: any;
241
+ result?: any;
242
+ }, {
243
+ toolName: string;
244
+ toolCallId: string;
245
+ state: string;
246
+ args?: any;
247
+ result?: any;
248
+ }>;
249
+ additionalData: z.ZodOptional<z.ZodAny>;
250
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
251
+ }, "strip", z.ZodTypeAny, {
252
+ type: "tool-invocation";
253
+ toolInvocation: {
254
+ toolName: string;
255
+ toolCallId: string;
256
+ state: string;
257
+ args?: any;
258
+ result?: any;
259
+ };
260
+ isCompleted?: boolean | undefined;
261
+ additionalData?: any;
262
+ }, {
263
+ type: "tool-invocation";
264
+ toolInvocation: {
265
+ toolName: string;
266
+ toolCallId: string;
267
+ state: string;
268
+ args?: any;
269
+ result?: any;
270
+ };
271
+ isCompleted?: boolean | undefined;
272
+ additionalData?: any;
273
+ }>, z.ZodObject<{
274
+ type: z.ZodString;
275
+ additionalData: z.ZodOptional<z.ZodAny>;
276
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
277
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
278
+ type: z.ZodString;
279
+ additionalData: z.ZodOptional<z.ZodAny>;
280
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
281
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
282
+ type: z.ZodString;
283
+ additionalData: z.ZodOptional<z.ZodAny>;
284
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
285
+ }, z.ZodTypeAny, "passthrough">>]>, "many">>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ parts?: ({
288
+ type: "text";
289
+ text: string;
290
+ isCompleted?: boolean | undefined;
291
+ additionalData?: any;
292
+ } | {
293
+ type: "tool-invocation";
294
+ toolInvocation: {
295
+ toolName: string;
296
+ toolCallId: string;
297
+ state: string;
298
+ args?: any;
299
+ result?: any;
300
+ };
301
+ isCompleted?: boolean | undefined;
302
+ additionalData?: any;
303
+ } | z.objectOutputType<{
304
+ type: z.ZodString;
305
+ additionalData: z.ZodOptional<z.ZodAny>;
306
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
307
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
308
+ }, {
309
+ parts?: ({
310
+ type: "text";
311
+ text: string;
312
+ isCompleted?: boolean | undefined;
313
+ additionalData?: any;
314
+ } | {
315
+ type: "tool-invocation";
316
+ toolInvocation: {
317
+ toolName: string;
318
+ toolCallId: string;
319
+ state: string;
320
+ args?: any;
321
+ result?: any;
322
+ };
323
+ isCompleted?: boolean | undefined;
324
+ additionalData?: any;
325
+ } | z.objectInputType<{
326
+ type: z.ZodString;
327
+ additionalData: z.ZodOptional<z.ZodAny>;
328
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
329
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
330
+ }>, {
331
+ parts?: ({
332
+ type: "text";
333
+ text: string;
334
+ isCompleted?: boolean | undefined;
335
+ additionalData?: any;
336
+ } | {
337
+ type: "tool-invocation";
338
+ toolInvocation: {
339
+ toolName: string;
340
+ toolCallId: string;
341
+ state: string;
342
+ args?: any;
343
+ result?: any;
344
+ };
345
+ isCompleted?: boolean | undefined;
346
+ additionalData?: any;
347
+ } | z.objectOutputType<{
348
+ type: z.ZodString;
349
+ additionalData: z.ZodOptional<z.ZodAny>;
350
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
351
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
352
+ }, unknown>;
353
+ errorMessage: z.ZodOptional<z.ZodObject<{
354
+ error: z.ZodString;
355
+ }, "strip", z.ZodTypeAny, {
356
+ error: string;
357
+ }, {
358
+ error: string;
359
+ }>>;
360
+ isCompleted: z.ZodBoolean;
361
+ }, "strip", z.ZodTypeAny, {
362
+ isCompleted: boolean;
363
+ id: string;
364
+ prompt: string;
365
+ streamMessage: {
366
+ parts?: ({
367
+ type: "text";
368
+ text: string;
369
+ isCompleted?: boolean | undefined;
370
+ additionalData?: any;
371
+ } | {
372
+ type: "tool-invocation";
373
+ toolInvocation: {
374
+ toolName: string;
375
+ toolCallId: string;
376
+ state: string;
377
+ args?: any;
378
+ result?: any;
379
+ };
380
+ isCompleted?: boolean | undefined;
381
+ additionalData?: any;
382
+ } | z.objectOutputType<{
383
+ type: z.ZodString;
384
+ additionalData: z.ZodOptional<z.ZodAny>;
385
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
386
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
387
+ };
388
+ errorMessage?: {
389
+ error: string;
390
+ } | undefined;
391
+ }, {
392
+ isCompleted: boolean;
393
+ id: string;
394
+ prompt: string;
395
+ streamMessage?: unknown;
396
+ errorMessage?: {
397
+ error: string;
398
+ } | undefined;
399
+ }>, "many">;
400
+ createdAt: z.ZodOptional<z.ZodDate>;
401
+ }, "strip", z.ZodTypeAny, {
402
+ id: string;
403
+ name: string;
404
+ modelProvider: string;
405
+ model: string;
406
+ analysisResults: {
407
+ isCompleted: boolean;
408
+ id: string;
409
+ prompt: string;
410
+ streamMessage: {
411
+ parts?: ({
412
+ type: "text";
413
+ text: string;
414
+ isCompleted?: boolean | undefined;
415
+ additionalData?: any;
416
+ } | {
417
+ type: "tool-invocation";
418
+ toolInvocation: {
419
+ toolName: string;
420
+ toolCallId: string;
421
+ state: string;
422
+ args?: any;
423
+ result?: any;
424
+ };
425
+ isCompleted?: boolean | undefined;
426
+ additionalData?: any;
427
+ } | z.objectOutputType<{
428
+ type: z.ZodString;
429
+ additionalData: z.ZodOptional<z.ZodAny>;
430
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
431
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
432
+ };
433
+ errorMessage?: {
434
+ error: string;
435
+ } | undefined;
436
+ }[];
437
+ baseUrl?: string | undefined;
438
+ customModelName?: string | undefined;
439
+ createdAt?: Date | undefined;
440
+ }, {
441
+ id: string;
442
+ name: string;
443
+ modelProvider: string;
444
+ model: string;
445
+ analysisResults: {
446
+ isCompleted: boolean;
447
+ id: string;
448
+ prompt: string;
449
+ streamMessage?: unknown;
450
+ errorMessage?: {
451
+ error: string;
452
+ } | undefined;
453
+ }[];
454
+ baseUrl?: string | undefined;
455
+ customModelName?: string | undefined;
456
+ createdAt?: Date | undefined;
457
+ }>, {
458
+ id: string;
459
+ name: string;
460
+ modelProvider: string;
461
+ model: string;
462
+ analysisResults: {
463
+ isCompleted: boolean;
464
+ id: string;
465
+ prompt: string;
466
+ streamMessage: {
467
+ parts?: ({
468
+ type: "text";
469
+ text: string;
470
+ isCompleted?: boolean | undefined;
471
+ additionalData?: any;
472
+ } | {
473
+ type: "tool-invocation";
474
+ toolInvocation: {
475
+ toolName: string;
476
+ toolCallId: string;
477
+ state: string;
478
+ args?: any;
479
+ result?: any;
480
+ };
481
+ isCompleted?: boolean | undefined;
482
+ additionalData?: any;
483
+ } | z.objectOutputType<{
484
+ type: z.ZodString;
485
+ additionalData: z.ZodOptional<z.ZodAny>;
486
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
487
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
488
+ };
489
+ errorMessage?: {
490
+ error: string;
491
+ } | undefined;
492
+ }[];
493
+ baseUrl?: string | undefined;
494
+ customModelName?: string | undefined;
495
+ createdAt?: Date | undefined;
496
+ }, unknown>;
497
+ export type AnalysisSessionSchema = z.infer<typeof AnalysisSessionSchema>;
498
+ //# sourceMappingURL=AnalysisSessionSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalysisSessionSchema.d.ts","sourceRoot":"","sources":["../src/AnalysisSessionSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAgEpE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA4CmsB,CAAC;sBAAqB,CAAC;;;;;oBAAyG,CAAC;sBAAqB,CAAC;;;;;;;;;;oBAAkR,CAAC;sBAAqB,CAAC;;;;;;;;;;oBAAgO,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAA9Q,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;oBAAgO,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;oBAA9Q,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAAvB,CAAC;sBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;EAtClqC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAmCxE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAEksB,CAAC;0BAAqB,CAAC;;;;;wBAAyG,CAAC;0BAAqB,CAAC;;;;;;;;;;wBAAkR,CAAC;0BAAqB,CAAC;;;;;;;;;;wBAAgO,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAA9Q,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;wBAAgO,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;wBAA9Q,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAAvB,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAAvB,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAAvB,CAAC;0BAAqB,CAAC;;;;;;;;;;;;;;;;;WAFzmC,CAAC;AAC5D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { z } from 'zod';
2
+ import { StreamMessagePartSchema } from '@openassistant/core';
3
+ export const ErrorMessageSchema = z.object({
4
+ error: z.string(),
5
+ });
6
+ // migrate from old streamMessage to new streamMessage
7
+ const migrateStreamMessage = z.preprocess((data) => {
8
+ if (data &&
9
+ typeof data === 'object' &&
10
+ 'toolCallMessages' in data &&
11
+ 'parts' in data) {
12
+ // migrate from old streamMessage to new streamMessage
13
+ const parts = data.parts;
14
+ const newParts = [];
15
+ for (const part of parts) {
16
+ if (part.type === 'text') {
17
+ const text = part.text;
18
+ newParts.push({
19
+ type: 'text',
20
+ text,
21
+ });
22
+ }
23
+ else if (part.type === 'tool') {
24
+ const toolCallMessages = part.toolCallMessages;
25
+ for (const toolCallMessage of toolCallMessages) {
26
+ const toolCallId = toolCallMessage.toolCallId;
27
+ const toolName = toolCallMessage.toolName;
28
+ const args = toolCallMessage.args;
29
+ const isCompleted = toolCallMessage.isCompleted;
30
+ const llmResult = toolCallMessage.llmResult;
31
+ const additionalData = toolCallMessage.additionalData;
32
+ const toolInvocation = {
33
+ toolCallId,
34
+ toolName,
35
+ args,
36
+ state: isCompleted ? 'result' : 'call',
37
+ result: llmResult,
38
+ };
39
+ newParts.push({
40
+ type: 'tool-invocation',
41
+ toolInvocation,
42
+ additionalData,
43
+ isCompleted,
44
+ });
45
+ }
46
+ }
47
+ }
48
+ return {
49
+ parts: newParts,
50
+ };
51
+ }
52
+ return data;
53
+ }, z.object({
54
+ parts: z.array(StreamMessagePartSchema).optional(),
55
+ }));
56
+ export const AnalysisResultSchema = z.object({
57
+ id: z.string().cuid2(),
58
+ prompt: z.string(),
59
+ streamMessage: migrateStreamMessage,
60
+ errorMessage: ErrorMessageSchema.optional(),
61
+ isCompleted: z.boolean(),
62
+ });
63
+ // migrate from old ollamaBaseUrl to new baseUrl
64
+ const migrateAnalysisSession = z.preprocess((data) => {
65
+ if (data &&
66
+ typeof data === 'object' &&
67
+ 'ollamaBaseUrl' in data &&
68
+ !('baseUrl' in data)) {
69
+ // migrate from old ollamaBaseUrl to new baseUrl
70
+ const { ollamaBaseUrl, ...rest } = data;
71
+ return {
72
+ ...rest,
73
+ baseUrl: ollamaBaseUrl,
74
+ };
75
+ }
76
+ return data;
77
+ }, z.object({
78
+ id: z.string().cuid2(),
79
+ name: z.string(),
80
+ modelProvider: z.string(),
81
+ model: z.string(),
82
+ customModelName: z.string().optional(),
83
+ baseUrl: z.string().optional(),
84
+ analysisResults: z.array(AnalysisResultSchema),
85
+ createdAt: z.coerce.date().optional(),
86
+ }));
87
+ export const AnalysisSessionSchema = migrateAnalysisSession;
88
+ //# sourceMappingURL=AnalysisSessionSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalysisSessionSchema.js","sourceRoot":"","sources":["../src/AnalysisSessionSchema.ts"],"names":[],"mappings":"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","sourcesContent":["import {z} from 'zod';\nimport {StreamMessagePartSchema} from '@openassistant/core';\n\nexport const ErrorMessageSchema = z.object({\n error: z.string(),\n});\nexport type ErrorMessageSchema = z.infer<typeof ErrorMessageSchema>;\n\n// migrate from old streamMessage to new streamMessage\nconst migrateStreamMessage = z.preprocess(\n (data) => {\n if (\n data &&\n typeof data === 'object' &&\n 'toolCallMessages' in data &&\n 'parts' in data\n ) {\n // migrate from old streamMessage to new streamMessage\n const parts = (data as {parts: Record<string, unknown>[]}).parts;\n\n const newParts = [];\n for (const part of parts) {\n if (part.type === 'text') {\n const text = part.text;\n newParts.push({\n type: 'text',\n text,\n });\n } else if (part.type === 'tool') {\n const toolCallMessages = part.toolCallMessages as Record<\n string,\n unknown\n >[];\n for (const toolCallMessage of toolCallMessages) {\n const toolCallId = toolCallMessage.toolCallId;\n const toolName = toolCallMessage.toolName;\n const args = toolCallMessage.args;\n const isCompleted = toolCallMessage.isCompleted;\n const llmResult = toolCallMessage.llmResult;\n const additionalData = toolCallMessage.additionalData;\n\n const toolInvocation = {\n toolCallId,\n toolName,\n args,\n state: isCompleted ? 'result' : 'call',\n result: llmResult,\n };\n\n newParts.push({\n type: 'tool-invocation',\n toolInvocation,\n additionalData,\n isCompleted,\n });\n }\n }\n }\n\n return {\n parts: newParts,\n };\n }\n return data;\n },\n z.object({\n parts: z.array(StreamMessagePartSchema).optional(),\n }),\n);\n\nexport const AnalysisResultSchema = z.object({\n id: z.string().cuid2(),\n prompt: z.string(),\n streamMessage: migrateStreamMessage,\n errorMessage: ErrorMessageSchema.optional(),\n isCompleted: z.boolean(),\n});\nexport type AnalysisResultSchema = z.infer<typeof AnalysisResultSchema>;\n\n// migrate from old ollamaBaseUrl to new baseUrl\nconst migrateAnalysisSession = z.preprocess(\n (data) => {\n if (\n data &&\n typeof data === 'object' &&\n 'ollamaBaseUrl' in data &&\n !('baseUrl' in data)\n ) {\n // migrate from old ollamaBaseUrl to new baseUrl\n const {ollamaBaseUrl, ...rest} = data as {ollamaBaseUrl: string} & Record<\n string,\n unknown\n >;\n return {\n ...rest,\n baseUrl: ollamaBaseUrl,\n };\n }\n return data;\n },\n z.object({\n id: z.string().cuid2(),\n name: z.string(),\n modelProvider: z.string(),\n model: z.string(),\n customModelName: z.string().optional(),\n baseUrl: z.string().optional(),\n analysisResults: z.array(AnalysisResultSchema),\n createdAt: z.coerce.date().optional(),\n }),\n);\n\nexport const AnalysisSessionSchema = migrateAnalysisSession;\nexport type AnalysisSessionSchema = z.infer<typeof AnalysisSessionSchema>;\n"]}
@@ -0,0 +1,4 @@
1
+ export { AiSliceConfig, createDefaultAiConfig } from './AiSliceConfig';
2
+ export { AiSettingsSliceConfig } from './AiSettingsSliceConfig';
3
+ export { AnalysisSessionSchema, AnalysisResultSchema, ErrorMessageSchema, } from './AnalysisSessionSchema';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { AiSliceConfig, createDefaultAiConfig } from './AiSliceConfig';
2
+ export { AiSettingsSliceConfig } from './AiSettingsSliceConfig';
3
+ export { AnalysisSessionSchema, AnalysisResultSchema, ErrorMessageSchema, } from './AnalysisSessionSchema';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC","sourcesContent":["export {AiSliceConfig, createDefaultAiConfig} from './AiSliceConfig';\nexport {AiSettingsSliceConfig} from './AiSettingsSliceConfig';\nexport {\n AnalysisSessionSchema,\n AnalysisResultSchema,\n ErrorMessageSchema,\n} from './AnalysisSessionSchema';\n"]}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@sqlrooms/ai-config",
3
+ "version": "0.26.0-rc.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "module": "dist/index.js",
7
+ "type": "module",
8
+ "author": "Ilya Boyandin <ilya@boyandin.me>",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/sqlrooms/sqlrooms.git"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "dependencies": {
21
+ "@openassistant/core": "0.5.17",
22
+ "@paralleldrive/cuid2": "^2.2.2",
23
+ "zod": "^3.25.73"
24
+ },
25
+ "scripts": {
26
+ "dev": "tsc -w",
27
+ "build": "tsc",
28
+ "lint": "eslint .",
29
+ "typecheck": "tsc --noEmit",
30
+ "typedoc": "typedoc"
31
+ },
32
+ "gitHead": "05d355acee6ea65b33b09c6e49d7746ffacb866e"
33
+ }