@sqlrooms/canvas 0.24.17

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 (39) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +6 -0
  3. package/dist/Canvas.d.ts +4 -0
  4. package/dist/Canvas.d.ts.map +1 -0
  5. package/dist/Canvas.js +28 -0
  6. package/dist/Canvas.js.map +1 -0
  7. package/dist/CanvasAssistantDrawer.d.ts +3 -0
  8. package/dist/CanvasAssistantDrawer.d.ts.map +1 -0
  9. package/dist/CanvasAssistantDrawer.js +14 -0
  10. package/dist/CanvasAssistantDrawer.js.map +1 -0
  11. package/dist/CanvasSlice.d.ts +807 -0
  12. package/dist/CanvasSlice.d.ts.map +1 -0
  13. package/dist/CanvasSlice.js +338 -0
  14. package/dist/CanvasSlice.js.map +1 -0
  15. package/dist/dag.d.ts +53 -0
  16. package/dist/dag.d.ts.map +1 -0
  17. package/dist/dag.js +126 -0
  18. package/dist/dag.js.map +1 -0
  19. package/dist/index.d.ts +9 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +8 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/nodes/AddNodePopover.d.ts +6 -0
  24. package/dist/nodes/AddNodePopover.d.ts.map +1 -0
  25. package/dist/nodes/AddNodePopover.js +18 -0
  26. package/dist/nodes/AddNodePopover.js.map +1 -0
  27. package/dist/nodes/CanvasNodeContainer.d.ts +13 -0
  28. package/dist/nodes/CanvasNodeContainer.d.ts.map +1 -0
  29. package/dist/nodes/CanvasNodeContainer.js +31 -0
  30. package/dist/nodes/CanvasNodeContainer.js.map +1 -0
  31. package/dist/nodes/SqlNode.d.ts +11 -0
  32. package/dist/nodes/SqlNode.d.ts.map +1 -0
  33. package/dist/nodes/SqlNode.js +36 -0
  34. package/dist/nodes/SqlNode.js.map +1 -0
  35. package/dist/nodes/VegaNode.d.ts +11 -0
  36. package/dist/nodes/VegaNode.d.ts.map +1 -0
  37. package/dist/nodes/VegaNode.js +12 -0
  38. package/dist/nodes/VegaNode.js.map +1 -0
  39. package/package.json +45 -0
@@ -0,0 +1,807 @@
1
+ import { AiSliceState, createAiSlice } from '@sqlrooms/ai';
2
+ import { BaseRoomConfig, RoomShellSliceState } from '@sqlrooms/room-shell';
3
+ import type { Viewport, XYPosition } from '@xyflow/react';
4
+ import { Connection, type EdgeChange, type NodeChange } from '@xyflow/react';
5
+ import { z } from 'zod';
6
+ export declare const CanvasNodeTypes: z.ZodEnum<["sql", "vega"]>;
7
+ export type CanvasNodeTypes = z.infer<typeof CanvasNodeTypes>;
8
+ export declare const CanvasNodeData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
9
+ title: z.ZodDefault<z.ZodString>;
10
+ type: z.ZodLiteral<"sql">;
11
+ sql: z.ZodOptional<z.ZodString>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ type: "sql";
14
+ title: string;
15
+ sql?: string | undefined;
16
+ }, {
17
+ type: "sql";
18
+ sql?: string | undefined;
19
+ title?: string | undefined;
20
+ }>, z.ZodObject<{
21
+ title: z.ZodDefault<z.ZodString>;
22
+ type: z.ZodLiteral<"vega">;
23
+ sql: z.ZodOptional<z.ZodString>;
24
+ vegaSpec: z.ZodOptional<z.ZodAny>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ type: "vega";
27
+ title: string;
28
+ sql?: string | undefined;
29
+ vegaSpec?: any;
30
+ }, {
31
+ type: "vega";
32
+ sql?: string | undefined;
33
+ title?: string | undefined;
34
+ vegaSpec?: any;
35
+ }>]>;
36
+ export type CanvasNodeData = z.infer<typeof CanvasNodeData>;
37
+ export declare const CanvasNodeSchema: z.ZodObject<{
38
+ id: z.ZodString;
39
+ position: z.ZodObject<{
40
+ x: z.ZodNumber;
41
+ y: z.ZodNumber;
42
+ }, "strip", z.ZodTypeAny, {
43
+ x: number;
44
+ y: number;
45
+ }, {
46
+ x: number;
47
+ y: number;
48
+ }>;
49
+ type: z.ZodEnum<["sql", "vega"]>;
50
+ data: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
51
+ title: z.ZodDefault<z.ZodString>;
52
+ type: z.ZodLiteral<"sql">;
53
+ sql: z.ZodOptional<z.ZodString>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ type: "sql";
56
+ title: string;
57
+ sql?: string | undefined;
58
+ }, {
59
+ type: "sql";
60
+ sql?: string | undefined;
61
+ title?: string | undefined;
62
+ }>, z.ZodObject<{
63
+ title: z.ZodDefault<z.ZodString>;
64
+ type: z.ZodLiteral<"vega">;
65
+ sql: z.ZodOptional<z.ZodString>;
66
+ vegaSpec: z.ZodOptional<z.ZodAny>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ type: "vega";
69
+ title: string;
70
+ sql?: string | undefined;
71
+ vegaSpec?: any;
72
+ }, {
73
+ type: "vega";
74
+ sql?: string | undefined;
75
+ title?: string | undefined;
76
+ vegaSpec?: any;
77
+ }>]>;
78
+ width: z.ZodNumber;
79
+ height: z.ZodNumber;
80
+ }, "strip", z.ZodTypeAny, {
81
+ type: "sql" | "vega";
82
+ id: string;
83
+ position: {
84
+ x: number;
85
+ y: number;
86
+ };
87
+ data: {
88
+ type: "sql";
89
+ title: string;
90
+ sql?: string | undefined;
91
+ } | {
92
+ type: "vega";
93
+ title: string;
94
+ sql?: string | undefined;
95
+ vegaSpec?: any;
96
+ };
97
+ width: number;
98
+ height: number;
99
+ }, {
100
+ type: "sql" | "vega";
101
+ id: string;
102
+ position: {
103
+ x: number;
104
+ y: number;
105
+ };
106
+ data: {
107
+ type: "sql";
108
+ sql?: string | undefined;
109
+ title?: string | undefined;
110
+ } | {
111
+ type: "vega";
112
+ sql?: string | undefined;
113
+ title?: string | undefined;
114
+ vegaSpec?: any;
115
+ };
116
+ width: number;
117
+ height: number;
118
+ }>;
119
+ export type CanvasNodeSchema = z.infer<typeof CanvasNodeSchema>;
120
+ export declare const CanvasEdgeSchema: z.ZodObject<{
121
+ id: z.ZodString;
122
+ source: z.ZodString;
123
+ target: z.ZodString;
124
+ }, "strip", z.ZodTypeAny, {
125
+ id: string;
126
+ source: string;
127
+ target: string;
128
+ }, {
129
+ id: string;
130
+ source: string;
131
+ target: string;
132
+ }>;
133
+ export type CanvasEdgeSchema = z.infer<typeof CanvasEdgeSchema>;
134
+ export type SqlNodeQueryResult = {
135
+ status: 'idle';
136
+ } | {
137
+ status: 'loading';
138
+ } | {
139
+ status: 'error';
140
+ error: string;
141
+ } | {
142
+ status: 'success';
143
+ tableName: string;
144
+ lastQueryStatement: string;
145
+ };
146
+ export declare const CanvasSliceConfig: z.ZodObject<{
147
+ canvas: z.ZodObject<{
148
+ viewport: z.ZodObject<{
149
+ x: z.ZodNumber;
150
+ y: z.ZodNumber;
151
+ zoom: z.ZodNumber;
152
+ }, "strip", z.ZodTypeAny, {
153
+ x: number;
154
+ y: number;
155
+ zoom: number;
156
+ }, {
157
+ x: number;
158
+ y: number;
159
+ zoom: number;
160
+ }>;
161
+ nodes: z.ZodDefault<z.ZodArray<z.ZodObject<{
162
+ id: z.ZodString;
163
+ position: z.ZodObject<{
164
+ x: z.ZodNumber;
165
+ y: z.ZodNumber;
166
+ }, "strip", z.ZodTypeAny, {
167
+ x: number;
168
+ y: number;
169
+ }, {
170
+ x: number;
171
+ y: number;
172
+ }>;
173
+ type: z.ZodEnum<["sql", "vega"]>;
174
+ data: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
175
+ title: z.ZodDefault<z.ZodString>;
176
+ type: z.ZodLiteral<"sql">;
177
+ sql: z.ZodOptional<z.ZodString>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ type: "sql";
180
+ title: string;
181
+ sql?: string | undefined;
182
+ }, {
183
+ type: "sql";
184
+ sql?: string | undefined;
185
+ title?: string | undefined;
186
+ }>, z.ZodObject<{
187
+ title: z.ZodDefault<z.ZodString>;
188
+ type: z.ZodLiteral<"vega">;
189
+ sql: z.ZodOptional<z.ZodString>;
190
+ vegaSpec: z.ZodOptional<z.ZodAny>;
191
+ }, "strip", z.ZodTypeAny, {
192
+ type: "vega";
193
+ title: string;
194
+ sql?: string | undefined;
195
+ vegaSpec?: any;
196
+ }, {
197
+ type: "vega";
198
+ sql?: string | undefined;
199
+ title?: string | undefined;
200
+ vegaSpec?: any;
201
+ }>]>;
202
+ width: z.ZodNumber;
203
+ height: z.ZodNumber;
204
+ }, "strip", z.ZodTypeAny, {
205
+ type: "sql" | "vega";
206
+ id: string;
207
+ position: {
208
+ x: number;
209
+ y: number;
210
+ };
211
+ data: {
212
+ type: "sql";
213
+ title: string;
214
+ sql?: string | undefined;
215
+ } | {
216
+ type: "vega";
217
+ title: string;
218
+ sql?: string | undefined;
219
+ vegaSpec?: any;
220
+ };
221
+ width: number;
222
+ height: number;
223
+ }, {
224
+ type: "sql" | "vega";
225
+ id: string;
226
+ position: {
227
+ x: number;
228
+ y: number;
229
+ };
230
+ data: {
231
+ type: "sql";
232
+ sql?: string | undefined;
233
+ title?: string | undefined;
234
+ } | {
235
+ type: "vega";
236
+ sql?: string | undefined;
237
+ title?: string | undefined;
238
+ vegaSpec?: any;
239
+ };
240
+ width: number;
241
+ height: number;
242
+ }>, "many">>;
243
+ edges: z.ZodDefault<z.ZodArray<z.ZodObject<{
244
+ id: z.ZodString;
245
+ source: z.ZodString;
246
+ target: z.ZodString;
247
+ }, "strip", z.ZodTypeAny, {
248
+ id: string;
249
+ source: string;
250
+ target: string;
251
+ }, {
252
+ id: string;
253
+ source: string;
254
+ target: string;
255
+ }>, "many">>;
256
+ }, "strip", z.ZodTypeAny, {
257
+ viewport: {
258
+ x: number;
259
+ y: number;
260
+ zoom: number;
261
+ };
262
+ nodes: {
263
+ type: "sql" | "vega";
264
+ id: string;
265
+ position: {
266
+ x: number;
267
+ y: number;
268
+ };
269
+ data: {
270
+ type: "sql";
271
+ title: string;
272
+ sql?: string | undefined;
273
+ } | {
274
+ type: "vega";
275
+ title: string;
276
+ sql?: string | undefined;
277
+ vegaSpec?: any;
278
+ };
279
+ width: number;
280
+ height: number;
281
+ }[];
282
+ edges: {
283
+ id: string;
284
+ source: string;
285
+ target: string;
286
+ }[];
287
+ }, {
288
+ viewport: {
289
+ x: number;
290
+ y: number;
291
+ zoom: number;
292
+ };
293
+ nodes?: {
294
+ type: "sql" | "vega";
295
+ id: string;
296
+ position: {
297
+ x: number;
298
+ y: number;
299
+ };
300
+ data: {
301
+ type: "sql";
302
+ sql?: string | undefined;
303
+ title?: string | undefined;
304
+ } | {
305
+ type: "vega";
306
+ sql?: string | undefined;
307
+ title?: string | undefined;
308
+ vegaSpec?: any;
309
+ };
310
+ width: number;
311
+ height: number;
312
+ }[] | undefined;
313
+ edges?: {
314
+ id: string;
315
+ source: string;
316
+ target: string;
317
+ }[] | undefined;
318
+ }>;
319
+ } & {
320
+ ai: z.ZodObject<{
321
+ sessions: z.ZodArray<z.ZodEffects<z.ZodObject<{
322
+ id: z.ZodString;
323
+ name: z.ZodString;
324
+ modelProvider: z.ZodString;
325
+ model: z.ZodString;
326
+ customModelName: z.ZodOptional<z.ZodString>;
327
+ baseUrl: z.ZodOptional<z.ZodString>;
328
+ analysisResults: z.ZodArray<z.ZodObject<{
329
+ id: z.ZodString;
330
+ prompt: z.ZodString;
331
+ streamMessage: z.ZodEffects<z.ZodObject<{
332
+ parts: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
333
+ type: z.ZodLiteral<"text">;
334
+ text: z.ZodString;
335
+ additionalData: z.ZodOptional<z.ZodAny>;
336
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
337
+ }, "strip", z.ZodTypeAny, {
338
+ type: "text";
339
+ text: string;
340
+ isCompleted?: boolean | undefined;
341
+ additionalData?: any;
342
+ }, {
343
+ type: "text";
344
+ text: string;
345
+ isCompleted?: boolean | undefined;
346
+ additionalData?: any;
347
+ }>, z.ZodObject<{
348
+ type: z.ZodLiteral<"tool-invocation">;
349
+ toolInvocation: z.ZodObject<{
350
+ toolCallId: z.ZodString;
351
+ toolName: z.ZodString;
352
+ args: z.ZodAny;
353
+ state: z.ZodString;
354
+ result: z.ZodOptional<z.ZodAny>;
355
+ }, "strip", z.ZodTypeAny, {
356
+ toolName: string;
357
+ toolCallId: string;
358
+ state: string;
359
+ args?: any;
360
+ result?: any;
361
+ }, {
362
+ toolName: string;
363
+ toolCallId: string;
364
+ state: string;
365
+ args?: any;
366
+ result?: any;
367
+ }>;
368
+ additionalData: z.ZodOptional<z.ZodAny>;
369
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
370
+ }, "strip", z.ZodTypeAny, {
371
+ type: "tool-invocation";
372
+ toolInvocation: {
373
+ toolName: string;
374
+ toolCallId: string;
375
+ state: string;
376
+ args?: any;
377
+ result?: any;
378
+ };
379
+ isCompleted?: boolean | undefined;
380
+ additionalData?: any;
381
+ }, {
382
+ type: "tool-invocation";
383
+ toolInvocation: {
384
+ toolName: string;
385
+ toolCallId: string;
386
+ state: string;
387
+ args?: any;
388
+ result?: any;
389
+ };
390
+ isCompleted?: boolean | undefined;
391
+ additionalData?: any;
392
+ }>, z.ZodObject<{
393
+ type: z.ZodString;
394
+ additionalData: z.ZodOptional<z.ZodAny>;
395
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
396
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
397
+ type: z.ZodString;
398
+ additionalData: z.ZodOptional<z.ZodAny>;
399
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
400
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
401
+ type: z.ZodString;
402
+ additionalData: z.ZodOptional<z.ZodAny>;
403
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
404
+ }, z.ZodTypeAny, "passthrough">>]>, "many">>;
405
+ }, "strip", z.ZodTypeAny, {
406
+ parts?: ({
407
+ type: "text";
408
+ text: string;
409
+ isCompleted?: boolean | undefined;
410
+ additionalData?: any;
411
+ } | {
412
+ type: "tool-invocation";
413
+ toolInvocation: {
414
+ toolName: string;
415
+ toolCallId: string;
416
+ state: string;
417
+ args?: any;
418
+ result?: any;
419
+ };
420
+ isCompleted?: boolean | undefined;
421
+ additionalData?: any;
422
+ } | z.objectOutputType<{
423
+ type: z.ZodString;
424
+ additionalData: z.ZodOptional<z.ZodAny>;
425
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
426
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
427
+ }, {
428
+ parts?: ({
429
+ type: "text";
430
+ text: string;
431
+ isCompleted?: boolean | undefined;
432
+ additionalData?: any;
433
+ } | {
434
+ type: "tool-invocation";
435
+ toolInvocation: {
436
+ toolName: string;
437
+ toolCallId: string;
438
+ state: string;
439
+ args?: any;
440
+ result?: any;
441
+ };
442
+ isCompleted?: boolean | undefined;
443
+ additionalData?: any;
444
+ } | z.objectInputType<{
445
+ type: z.ZodString;
446
+ additionalData: z.ZodOptional<z.ZodAny>;
447
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
448
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
449
+ }>, {
450
+ parts?: ({
451
+ type: "text";
452
+ text: string;
453
+ isCompleted?: boolean | undefined;
454
+ additionalData?: any;
455
+ } | {
456
+ type: "tool-invocation";
457
+ toolInvocation: {
458
+ toolName: string;
459
+ toolCallId: string;
460
+ state: string;
461
+ args?: any;
462
+ result?: any;
463
+ };
464
+ isCompleted?: boolean | undefined;
465
+ additionalData?: any;
466
+ } | z.objectOutputType<{
467
+ type: z.ZodString;
468
+ additionalData: z.ZodOptional<z.ZodAny>;
469
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
470
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
471
+ }, unknown>;
472
+ errorMessage: z.ZodOptional<z.ZodObject<{
473
+ error: z.ZodString;
474
+ }, "strip", z.ZodTypeAny, {
475
+ error: string;
476
+ }, {
477
+ error: string;
478
+ }>>;
479
+ isCompleted: z.ZodBoolean;
480
+ }, "strip", z.ZodTypeAny, {
481
+ id: string;
482
+ isCompleted: boolean;
483
+ prompt: string;
484
+ streamMessage: {
485
+ parts?: ({
486
+ type: "text";
487
+ text: string;
488
+ isCompleted?: boolean | undefined;
489
+ additionalData?: any;
490
+ } | {
491
+ type: "tool-invocation";
492
+ toolInvocation: {
493
+ toolName: string;
494
+ toolCallId: string;
495
+ state: string;
496
+ args?: any;
497
+ result?: any;
498
+ };
499
+ isCompleted?: boolean | undefined;
500
+ additionalData?: any;
501
+ } | z.objectOutputType<{
502
+ type: z.ZodString;
503
+ additionalData: z.ZodOptional<z.ZodAny>;
504
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
505
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
506
+ };
507
+ errorMessage?: {
508
+ error: string;
509
+ } | undefined;
510
+ }, {
511
+ id: string;
512
+ isCompleted: boolean;
513
+ prompt: string;
514
+ streamMessage?: unknown;
515
+ errorMessage?: {
516
+ error: string;
517
+ } | undefined;
518
+ }>, "many">;
519
+ createdAt: z.ZodOptional<z.ZodDate>;
520
+ }, "strip", z.ZodTypeAny, {
521
+ id: string;
522
+ name: string;
523
+ modelProvider: string;
524
+ model: string;
525
+ analysisResults: {
526
+ id: string;
527
+ isCompleted: boolean;
528
+ prompt: string;
529
+ streamMessage: {
530
+ parts?: ({
531
+ type: "text";
532
+ text: string;
533
+ isCompleted?: boolean | undefined;
534
+ additionalData?: any;
535
+ } | {
536
+ type: "tool-invocation";
537
+ toolInvocation: {
538
+ toolName: string;
539
+ toolCallId: string;
540
+ state: string;
541
+ args?: any;
542
+ result?: any;
543
+ };
544
+ isCompleted?: boolean | undefined;
545
+ additionalData?: any;
546
+ } | z.objectOutputType<{
547
+ type: z.ZodString;
548
+ additionalData: z.ZodOptional<z.ZodAny>;
549
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
550
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
551
+ };
552
+ errorMessage?: {
553
+ error: string;
554
+ } | undefined;
555
+ }[];
556
+ customModelName?: string | undefined;
557
+ baseUrl?: string | undefined;
558
+ createdAt?: Date | undefined;
559
+ }, {
560
+ id: string;
561
+ name: string;
562
+ modelProvider: string;
563
+ model: string;
564
+ analysisResults: {
565
+ id: string;
566
+ isCompleted: boolean;
567
+ prompt: string;
568
+ streamMessage?: unknown;
569
+ errorMessage?: {
570
+ error: string;
571
+ } | undefined;
572
+ }[];
573
+ customModelName?: string | undefined;
574
+ baseUrl?: string | undefined;
575
+ createdAt?: Date | undefined;
576
+ }>, {
577
+ id: string;
578
+ name: string;
579
+ modelProvider: string;
580
+ model: string;
581
+ analysisResults: {
582
+ id: string;
583
+ isCompleted: boolean;
584
+ prompt: string;
585
+ streamMessage: {
586
+ parts?: ({
587
+ type: "text";
588
+ text: string;
589
+ isCompleted?: boolean | undefined;
590
+ additionalData?: any;
591
+ } | {
592
+ type: "tool-invocation";
593
+ toolInvocation: {
594
+ toolName: string;
595
+ toolCallId: string;
596
+ state: string;
597
+ args?: any;
598
+ result?: any;
599
+ };
600
+ isCompleted?: boolean | undefined;
601
+ additionalData?: any;
602
+ } | z.objectOutputType<{
603
+ type: z.ZodString;
604
+ additionalData: z.ZodOptional<z.ZodAny>;
605
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
606
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
607
+ };
608
+ errorMessage?: {
609
+ error: string;
610
+ } | undefined;
611
+ }[];
612
+ customModelName?: string | undefined;
613
+ baseUrl?: string | undefined;
614
+ createdAt?: Date | undefined;
615
+ }, unknown>, "many">;
616
+ currentSessionId: z.ZodOptional<z.ZodString>;
617
+ }, "strip", z.ZodTypeAny, {
618
+ sessions: {
619
+ id: string;
620
+ name: string;
621
+ modelProvider: string;
622
+ model: string;
623
+ analysisResults: {
624
+ id: string;
625
+ isCompleted: boolean;
626
+ prompt: string;
627
+ streamMessage: {
628
+ parts?: ({
629
+ type: "text";
630
+ text: string;
631
+ isCompleted?: boolean | undefined;
632
+ additionalData?: any;
633
+ } | {
634
+ type: "tool-invocation";
635
+ toolInvocation: {
636
+ toolName: string;
637
+ toolCallId: string;
638
+ state: string;
639
+ args?: any;
640
+ result?: any;
641
+ };
642
+ isCompleted?: boolean | undefined;
643
+ additionalData?: any;
644
+ } | z.objectOutputType<{
645
+ type: z.ZodString;
646
+ additionalData: z.ZodOptional<z.ZodAny>;
647
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
648
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
649
+ };
650
+ errorMessage?: {
651
+ error: string;
652
+ } | undefined;
653
+ }[];
654
+ customModelName?: string | undefined;
655
+ baseUrl?: string | undefined;
656
+ createdAt?: Date | undefined;
657
+ }[];
658
+ currentSessionId?: string | undefined;
659
+ }, {
660
+ sessions: unknown[];
661
+ currentSessionId?: string | undefined;
662
+ }>;
663
+ }, "strip", z.ZodTypeAny, {
664
+ canvas: {
665
+ viewport: {
666
+ x: number;
667
+ y: number;
668
+ zoom: number;
669
+ };
670
+ nodes: {
671
+ type: "sql" | "vega";
672
+ id: string;
673
+ position: {
674
+ x: number;
675
+ y: number;
676
+ };
677
+ data: {
678
+ type: "sql";
679
+ title: string;
680
+ sql?: string | undefined;
681
+ } | {
682
+ type: "vega";
683
+ title: string;
684
+ sql?: string | undefined;
685
+ vegaSpec?: any;
686
+ };
687
+ width: number;
688
+ height: number;
689
+ }[];
690
+ edges: {
691
+ id: string;
692
+ source: string;
693
+ target: string;
694
+ }[];
695
+ };
696
+ ai: {
697
+ sessions: {
698
+ id: string;
699
+ name: string;
700
+ modelProvider: string;
701
+ model: string;
702
+ analysisResults: {
703
+ id: string;
704
+ isCompleted: boolean;
705
+ prompt: string;
706
+ streamMessage: {
707
+ parts?: ({
708
+ type: "text";
709
+ text: string;
710
+ isCompleted?: boolean | undefined;
711
+ additionalData?: any;
712
+ } | {
713
+ type: "tool-invocation";
714
+ toolInvocation: {
715
+ toolName: string;
716
+ toolCallId: string;
717
+ state: string;
718
+ args?: any;
719
+ result?: any;
720
+ };
721
+ isCompleted?: boolean | undefined;
722
+ additionalData?: any;
723
+ } | z.objectOutputType<{
724
+ type: z.ZodString;
725
+ additionalData: z.ZodOptional<z.ZodAny>;
726
+ isCompleted: z.ZodOptional<z.ZodBoolean>;
727
+ }, z.ZodTypeAny, "passthrough">)[] | undefined;
728
+ };
729
+ errorMessage?: {
730
+ error: string;
731
+ } | undefined;
732
+ }[];
733
+ customModelName?: string | undefined;
734
+ baseUrl?: string | undefined;
735
+ createdAt?: Date | undefined;
736
+ }[];
737
+ currentSessionId?: string | undefined;
738
+ };
739
+ }, {
740
+ canvas: {
741
+ viewport: {
742
+ x: number;
743
+ y: number;
744
+ zoom: number;
745
+ };
746
+ nodes?: {
747
+ type: "sql" | "vega";
748
+ id: string;
749
+ position: {
750
+ x: number;
751
+ y: number;
752
+ };
753
+ data: {
754
+ type: "sql";
755
+ sql?: string | undefined;
756
+ title?: string | undefined;
757
+ } | {
758
+ type: "vega";
759
+ sql?: string | undefined;
760
+ title?: string | undefined;
761
+ vegaSpec?: any;
762
+ };
763
+ width: number;
764
+ height: number;
765
+ }[] | undefined;
766
+ edges?: {
767
+ id: string;
768
+ source: string;
769
+ target: string;
770
+ }[] | undefined;
771
+ };
772
+ ai: {
773
+ sessions: unknown[];
774
+ currentSessionId?: string | undefined;
775
+ };
776
+ }>;
777
+ export type CanvasSliceConfig = z.infer<typeof CanvasSliceConfig>;
778
+ export type CanvasSliceState = AiSliceState & {
779
+ canvas: {
780
+ isAssistantOpen: boolean;
781
+ sqlResults: Record<string, SqlNodeQueryResult>;
782
+ initialize: () => Promise<void>;
783
+ setViewport: (viewport: Viewport) => void;
784
+ setAssistantOpen: (isAssistantOpen: boolean) => void;
785
+ addNode: (params: {
786
+ parentId?: string;
787
+ nodeType?: CanvasNodeTypes;
788
+ initialPosition?: XYPosition;
789
+ }) => string;
790
+ executeDownstreamFrom: (nodeId: string) => Promise<void>;
791
+ renameNode: (nodeId: string, newTitle: string) => Promise<void>;
792
+ updateNode: (nodeId: string, updater: (data: CanvasNodeData) => CanvasNodeData) => void;
793
+ deleteNode: (nodeId: string) => void;
794
+ applyNodeChanges: (changes: NodeChange<CanvasNodeSchema>[]) => void;
795
+ applyEdgeChanges: (changes: EdgeChange<CanvasEdgeSchema>[]) => void;
796
+ addEdge: (edge: Connection) => void;
797
+ executeSqlNodeQuery: (nodeId: string, opts?: {
798
+ cascade?: boolean;
799
+ }) => Promise<void>;
800
+ };
801
+ };
802
+ export declare function createDefaultCanvasConfig(props?: Partial<CanvasSliceConfig['canvas']>): CanvasSliceConfig;
803
+ export declare function createCanvasSlice<PC extends BaseRoomConfig & CanvasSliceConfig>(props: Parameters<typeof createAiSlice<PC>>[0]): import("zustand").StateCreator<CanvasSliceState>;
804
+ export type RoomConfigWithCanvas = BaseRoomConfig & CanvasSliceConfig;
805
+ export type RoomShellSliceStateWithCanvas = RoomShellSliceState<RoomConfigWithCanvas> & CanvasSliceState;
806
+ export declare function useStoreWithCanvas<T>(selector: (state: RoomShellSliceStateWithCanvas) => T): T;
807
+ //# sourceMappingURL=CanvasSlice.d.ts.map