@hasura/promptql 2.0.0-alpha.1 → 2.0.0-alpha.3

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.
@@ -1,2747 +0,0 @@
1
- /* eslint-disable */
2
- /**
3
- * This file was automatically generated by json-schema-to-typescript.
4
- * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
- * and run json-schema-to-typescript to regenerate this file.
6
- */
7
-
8
- /**
9
- * Everything that can happen in a chat thread
10
- */
11
- export type ThreadEvent =
12
- | {
13
- UserMessage: {
14
- /**
15
- * A unique index for a user message in a thread
16
- */
17
- message_id: string;
18
- user_id: PromptQlUserId;
19
- message: UserMessage;
20
- };
21
- }
22
- | {
23
- AgentMessage: {
24
- /**
25
- * A unique index for a agent message in a thread
26
- */
27
- message_id: string;
28
- update: AgentUpdate;
29
- };
30
- }
31
- | {
32
- UserCancel: {
33
- /**
34
- * A unique index for a agent message in a thread
35
- */
36
- message_id: string;
37
- user_id: PromptQlUserId;
38
- user_cancel: UserCancel;
39
- };
40
- }
41
- | {
42
- Internal: {
43
- update: InternalUpdate;
44
- };
45
- };
46
- export type PromptQlUserId = string;
47
- export type ArtifactId = string;
48
- /**
49
- * Updates sent by the agent during processing of a user interaction
50
- *
51
- * This enum represents all the different types of updates an agent can send
52
- * while processing a user's message, from initial message processing through
53
- * to final completion or error states.
54
- */
55
- export type AgentUpdate =
56
- | {
57
- MessageProcessingUpdate: {
58
- update: MessageProcessingUpdate;
59
- };
60
- }
61
- | {
62
- PlanningDecisionUpdate: {
63
- update: PlanningDecisionUpdate;
64
- };
65
- }
66
- | {
67
- StartingOrchestrator: {
68
- started_at: string;
69
- };
70
- }
71
- | {
72
- OrchestratorUpdate: {
73
- update: OrchestratorUpdate;
74
- };
75
- }
76
- | {
77
- ResponseGenerationUpdate: {
78
- update: ResponseGenerationUpdate;
79
- };
80
- }
81
- | {
82
- ConfidenceAnalysisUpdate: {
83
- update: ConfidenceAnalysisUpdate;
84
- };
85
- }
86
- | {
87
- WikiGenerationUpdate: {
88
- update: WikiGenerationUpdate;
89
- };
90
- }
91
- | {
92
- InteractionFinished: {
93
- update: InteractionFinishedUpdate;
94
- };
95
- };
96
- /**
97
- * Updates during the initial message processing phase
98
- *
99
- * This phase handles parsing the user's message, making interaction decisions,
100
- * processing the message content, and making assumptions about unclear requirements.
101
- */
102
- export type MessageProcessingUpdate =
103
- | {
104
- ProcessingStarted: {
105
- /**
106
- * When processing began
107
- */
108
- started_at: string;
109
- };
110
- }
111
- | {
112
- InteractionDecision: {
113
- /**
114
- * The decision made by the agent
115
- */
116
- decision:
117
- | {
118
- DeclineInteraction: {
119
- /**
120
- * When the decision was made
121
- */
122
- declined_at: string;
123
- /**
124
- * Why the interaction was declined
125
- */
126
- reason: "MultipleUsersAndNoPromptQlMention";
127
- };
128
- }
129
- | {
130
- AcceptInteraction: {
131
- /**
132
- * When the decision was made
133
- */
134
- accepted_at: string;
135
- };
136
- };
137
- };
138
- }
139
- | {
140
- ProcessedMessage: {
141
- /**
142
- * When the processing completed
143
- */
144
- generated_at: string;
145
- /**
146
- * LLM usage during message processing
147
- */
148
- llm_usage?: LlmUsage[];
149
- /**
150
- * The processed message broken down into spans with links
151
- */
152
- processed_user_message: Span[];
153
- };
154
- }
155
- | {
156
- ClarificationRequested: {
157
- /**
158
- * When the assumptions were generated
159
- */
160
- generated_at: string;
161
- /**
162
- * LLM usage during assumption generation
163
- */
164
- llm_usage?: LlmUsage[];
165
- /**
166
- * List of assumptions made by the agent
167
- */
168
- assumptions: string[];
169
- /**
170
- * Deprecated field, always None - clarification requests are no longer used
171
- */
172
- clarification_request?: string | null;
173
- };
174
- }
175
- | {
176
- WikiExplorerUpdate: {
177
- /**
178
- * The specific wiki exploration update
179
- */
180
- update:
181
- | {
182
- Started: {
183
- /**
184
- * When wiki exploration began
185
- */
186
- started_at: string;
187
- };
188
- }
189
- | {
190
- WikiInfoGenerated: {
191
- /**
192
- * Summary of relevant wiki information
193
- */
194
- wiki_summary: string;
195
- /**
196
- * IDs of wiki pages that were found to be relevant
197
- */
198
- wiki_page_ids: string[];
199
- /**
200
- * When this information was generated
201
- */
202
- generated_at: string;
203
- /**
204
- * LLM usage during wiki exploration
205
- */
206
- llm_usage?: LlmUsage[];
207
- };
208
- }
209
- | {
210
- Completed: {
211
- completed_at: string;
212
- };
213
- };
214
- };
215
- };
216
- export type PlanningDecisionUpdate =
217
- | {
218
- Started: {
219
- started_at: string;
220
- };
221
- }
222
- | {
223
- PlanningRequired: {
224
- planning_required: boolean;
225
- explanation: string;
226
- generated_at: string;
227
- llm_usage?: LlmUsage[];
228
- };
229
- }
230
- | {
231
- Completed: {
232
- completed_at: string;
233
- };
234
- };
235
- /**
236
- * Updates from the orchestrator during plan generation and execution
237
- *
238
- * The orchestrator is responsible for understanding the user's request,
239
- * exploring relevant context, generating execution plans, and coordinating
240
- * the execution of those plans through various specialized components.
241
- */
242
- export type OrchestratorUpdate =
243
- | {
244
- ContextExplorerUpdate: {
245
- update: ContextExplorerUpdate;
246
- };
247
- }
248
- | {
249
- PlanGenerationStarted: {
250
- /**
251
- * Index of the plan being generated (multiple plans may be created)
252
- */
253
- plan_index: number;
254
- /**
255
- * When plan generation started
256
- */
257
- generation_started_at: string;
258
- };
259
- }
260
- | {
261
- PlanStepGenerated: {
262
- /**
263
- * Index of the plan this step belongs to
264
- */
265
- plan_index: number;
266
- /**
267
- * Index of this step within the plan
268
- */
269
- step_index: number;
270
- /**
271
- * Version of this step (steps may be regenerated/refined)
272
- */
273
- version: number;
274
- /**
275
- * Type of step (programmer, UI programmer, etc.)
276
- */
277
- step_type?: "Programmer" | "UiProgrammer" | "SavedProgramRunner";
278
- /**
279
- * Human-readable title for this step
280
- */
281
- step_title: string;
282
- /**
283
- * Detailed instructions for executing this step
284
- */
285
- step_instructions?: string | null;
286
- /**
287
- * LLM usage during step generation
288
- */
289
- llm_usage?: LlmUsage[];
290
- /**
291
- * When this step was generated
292
- */
293
- generated_at: string;
294
- };
295
- }
296
- | {
297
- PlanGenerationCompleted: {
298
- /**
299
- * Index of the completed plan
300
- */
301
- plan_index: number;
302
- /**
303
- * When plan generation finished
304
- */
305
- generation_completed_at: string;
306
- };
307
- }
308
- | {
309
- StartingStepExecution: {
310
- /**
311
- * When step execution started
312
- */
313
- started_at: string;
314
- /**
315
- * Index of the plan containing this step
316
- */
317
- plan_index: number;
318
- /**
319
- * Index of the step being executed
320
- */
321
- step_index: number;
322
- };
323
- }
324
- | {
325
- StepUpdate: {
326
- /**
327
- * Index of the plan containing this step
328
- */
329
- plan_index: number;
330
- /**
331
- * Index of the step being executed
332
- */
333
- step_index: number;
334
- /**
335
- * The specific update from the step
336
- */
337
- update:
338
- | {
339
- Programmer: ProgrammerUpdate;
340
- }
341
- | {
342
- UiProgrammer: UiProgrammerUpdate;
343
- }
344
- | {
345
- SavedProgramRunner: SavedProgramRunnerUpdate;
346
- };
347
- };
348
- }
349
- | {
350
- GeneratedResponse: {
351
- response: ComponentResponse5;
352
- /**
353
- * LLM usage during response generation
354
- */
355
- llm_usage?: LlmUsage[];
356
- };
357
- };
358
- /**
359
- * Updates from the context exploration phase
360
- *
361
- * Context exploration gathers relevant information from various sources
362
- * like wiki pages and database schemas to provide context for the user's request.
363
- */
364
- export type ContextExplorerUpdate =
365
- | {
366
- Started: {
367
- /**
368
- * When context exploration began
369
- */
370
- started_at: string;
371
- };
372
- }
373
- | {
374
- WikiExplorerUpdate: {
375
- /**
376
- * The specific wiki exploration update
377
- */
378
- update:
379
- | {
380
- Started: {
381
- /**
382
- * When wiki exploration began
383
- */
384
- started_at: string;
385
- };
386
- }
387
- | {
388
- WikiInfoGenerated: {
389
- /**
390
- * Summary of relevant wiki information
391
- */
392
- wiki_summary: string;
393
- /**
394
- * IDs of wiki pages that were found to be relevant
395
- */
396
- wiki_page_ids: string[];
397
- /**
398
- * When this information was generated
399
- */
400
- generated_at: string;
401
- /**
402
- * LLM usage during wiki exploration
403
- */
404
- llm_usage?: LlmUsage[];
405
- };
406
- }
407
- | {
408
- Completed: {
409
- completed_at: string;
410
- };
411
- };
412
- };
413
- }
414
- | {
415
- SchemaTasksGenerationUpdate: {
416
- update: SchemaTasksGenerationUpdate;
417
- };
418
- }
419
- | {
420
- SchemaExplorerUpdate: {
421
- /**
422
- * The specific schema exploration update
423
- */
424
- update:
425
- | {
426
- Started: {
427
- /**
428
- * When schema exploration began
429
- */
430
- started_at: string;
431
- };
432
- }
433
- | {
434
- GeneratedCode: {
435
- /**
436
- * Name of the artifact containing the exploration code
437
- */
438
- artifact_name: string;
439
- /**
440
- * The generated code for schema exploration
441
- */
442
- code: string;
443
- /**
444
- * When the code was generated
445
- */
446
- generated_at: string;
447
- /**
448
- * LLM usage during code generation
449
- */
450
- llm_usage?: LlmUsage[];
451
- };
452
- }
453
- | {
454
- CodeExecutionComplete: {
455
- /**
456
- * Output from the schema exploration code
457
- */
458
- output: string;
459
- /**
460
- * Error message if execution failed
461
- */
462
- error?: string | null;
463
- /**
464
- * When execution completed
465
- */
466
- executed_at: string;
467
- };
468
- }
469
- | {
470
- CodeOutputAnalyzed: {
471
- analysis: CodeOutputAnalysis;
472
- /**
473
- * When the analysis was completed
474
- */
475
- analyzed_at: string;
476
- /**
477
- * LLM usage during analysis
478
- */
479
- llm_usage?: LlmUsage[];
480
- };
481
- }
482
- | {
483
- SchemaExplored: {
484
- schema_context: SchemaContext;
485
- /**
486
- * When the schema information was retrieved
487
- */
488
- retrieved_at: string;
489
- /**
490
- * LLM usage during schema exploration summary generation
491
- */
492
- llm_usage?: LlmUsage[];
493
- };
494
- }
495
- | {
496
- Completed: {
497
- /**
498
- * When schema exploration finished
499
- */
500
- completed_at: string;
501
- };
502
- };
503
- };
504
- }
505
- | {
506
- Completed: {
507
- /**
508
- * When context exploration finished
509
- */
510
- completed_at: string;
511
- };
512
- };
513
- export type SchemaTasksGenerationUpdate =
514
- | {
515
- Started: {
516
- started_at: string;
517
- };
518
- }
519
- | {
520
- TasksGenerated: {
521
- tasks: string[];
522
- generated_at: string;
523
- /**
524
- * LLM usage during wiki exploration
525
- */
526
- llm_usage?: LlmUsage[];
527
- };
528
- }
529
- | {
530
- Completed: {
531
- /**
532
- * When wiki exploration finished
533
- */
534
- completed_at: string;
535
- };
536
- };
537
- /**
538
- * Updates from a programmer step during execution
539
- *
540
- * Programmer steps can generate code, execute it, analyze results,
541
- * and provide summaries of their work.
542
- */
543
- export type ProgrammerUpdate =
544
- | {
545
- GeneratedCode: {
546
- /**
547
- * Index of the action within the step
548
- */
549
- action_index: number;
550
- /**
551
- * Name of the artifact containing the code
552
- */
553
- artifact_name: string;
554
- /**
555
- * The generated code content
556
- */
557
- code: string;
558
- /**
559
- * When the code was generated
560
- */
561
- generated_at: string;
562
- /**
563
- * LLM usage during code generation
564
- */
565
- llm_usage?: LlmUsage[];
566
- };
567
- }
568
- | {
569
- GeneratedSummary: {
570
- /**
571
- * Index of the action within the step
572
- */
573
- action_index: number;
574
- /**
575
- * Summary of what was accomplished
576
- */
577
- summary: string;
578
- /**
579
- * Whether the action was successful
580
- */
581
- success: boolean;
582
- /**
583
- * When the summary was generated
584
- */
585
- generated_at: string;
586
- /**
587
- * LLM usage during summary generation
588
- */
589
- llm_usage?: LlmUsage[];
590
- };
591
- }
592
- | {
593
- CodeExecutionStarted: {
594
- /**
595
- * Index of the action within the step
596
- */
597
- action_index: number;
598
- /**
599
- * When execution started
600
- */
601
- started_at: string;
602
- };
603
- }
604
- | {
605
- CodeExecutionUpdate: {
606
- /**
607
- * Index of the action within the step
608
- */
609
- action_index: number;
610
- /**
611
- * When this update occurred
612
- */
613
- updated_at: string;
614
- /**
615
- * The specific execution update
616
- */
617
- update:
618
- | {
619
- CodeOutput: string;
620
- }
621
- | {
622
- CodeError: string;
623
- }
624
- | {
625
- ArtifactAccess: string;
626
- }
627
- | {
628
- ArtifactUpdate: ArtifactUpdate;
629
- }
630
- | {
631
- ShelfAction: ShelfUpdate;
632
- };
633
- };
634
- }
635
- | {
636
- CodeExecutionComplete: {
637
- /**
638
- * Index of the action within the step
639
- */
640
- action_index: number;
641
- /**
642
- * Output from the code execution
643
- */
644
- output: string;
645
- /**
646
- * Error message if execution failed
647
- */
648
- error?: string | null;
649
- /**
650
- * When execution completed
651
- */
652
- executed_at: string;
653
- };
654
- }
655
- | {
656
- GeneratedAnalysis: {
657
- /**
658
- * Index of the action within the step
659
- */
660
- action_index: number;
661
- /**
662
- * Analysis of the code output
663
- */
664
- analysis: string;
665
- /**
666
- * Next steps to take (if any)
667
- */
668
- next_steps?: string | null;
669
- /**
670
- * When the analysis was generated
671
- */
672
- generated_at: string;
673
- /**
674
- * LLM usage during analysis generation
675
- */
676
- llm_usage?: LlmUsage[];
677
- };
678
- }
679
- | {
680
- ResponseGenerated: ComponentResponse;
681
- };
682
- export type ArtifactType = "text" | "table" | "visualization" | "html" | "file";
683
- export type ArtifactPreview = {
684
- Table: {
685
- total_row_count: number;
686
- preview_rows: {
687
- [k: string]: unknown;
688
- }[];
689
- };
690
- };
691
- export type ShelfUpdate = {
692
- v1: ShelfUpdateV1;
693
- };
694
- export type TransactionId = string;
695
- export type ShelfActionEvent =
696
- | ("Started" | "Completed")
697
- | {
698
- RowsInserted: {
699
- row_count: number;
700
- };
701
- };
702
- /**
703
- * Updates from a UI programmer step during execution
704
- *
705
- * UI programmer steps specialize in creating user interfaces using
706
- * React/TypeScript, including code generation, building, and iteration.
707
- */
708
- export type UiProgrammerUpdate =
709
- | {
710
- GeneratedCode: {
711
- generated_code: GeneratedUiCode;
712
- };
713
- }
714
- | {
715
- UiBuildCompleted: {
716
- /**
717
- * Result of the build (success or failure)
718
- */
719
- build_result:
720
- | {
721
- Success: BuiltUi;
722
- }
723
- | {
724
- Failure: UiBuildFailure;
725
- };
726
- };
727
- }
728
- | {
729
- Completed: {
730
- built_ui: BuiltUi1;
731
- response: ComponentResponse1;
732
- /**
733
- * LLM usage during completion
734
- */
735
- llm_usage?: LlmUsage[];
736
- };
737
- }
738
- | {
739
- FailedTooManyRetries: {
740
- response: ComponentResponse2;
741
- };
742
- };
743
- /**
744
- * Versioned updates from a saved program runner step during execution
745
- */
746
- export type SavedProgramRunnerUpdate = SavedProgramRunnerUpdateV0;
747
- /**
748
- * Updates from a saved program runner step during execution
749
- *
750
- * Saved program runner steps execute programs (either generated or from
751
- * saved program library) and provide updates throughout the execution lifecycle.
752
- */
753
- export type SavedProgramRunnerUpdateV0 =
754
- | {
755
- GeneratedOutput: {
756
- /**
757
- * Index of this attempt (0-based)
758
- */
759
- attempt_index: number;
760
- /**
761
- * Sequential list of actions to execute, preserving the order from LLM output
762
- */
763
- actions: ProgramRunnerAction[];
764
- /**
765
- * When the output was generated
766
- */
767
- generated_at: string;
768
- /**
769
- * LLM usage during generation
770
- */
771
- llm_usage?: LlmUsage[];
772
- };
773
- }
774
- | {
775
- ProgramRunStarted: {
776
- /**
777
- * Index of this attempt (0-based)
778
- */
779
- attempt_index: number;
780
- /**
781
- * Index of the action within the attempt
782
- */
783
- action_index: number;
784
- /**
785
- * When the run started
786
- */
787
- started_at: string;
788
- };
789
- }
790
- | {
791
- ProgramRunCompleted: {
792
- /**
793
- * Index of this attempt (0-based)
794
- */
795
- attempt_index: number;
796
- /**
797
- * Index of the action within the attempt
798
- */
799
- action_index: number;
800
- /**
801
- * Output from the run
802
- */
803
- output?: string | null;
804
- /**
805
- * Error message if the run failed
806
- */
807
- error?: string | null;
808
- /**
809
- * Artifacts modified during the run
810
- */
811
- modified_artifacts: ArtifactUpdate[];
812
- /**
813
- * When the run completed
814
- */
815
- completed_at: string;
816
- };
817
- }
818
- | {
819
- Completed: {
820
- response: ComponentResponse3;
821
- /**
822
- * LLM usage during completion
823
- */
824
- llm_usage?: LlmUsage[];
825
- };
826
- }
827
- | {
828
- FailedTooManyRetries: {
829
- response: ComponentResponse4;
830
- };
831
- };
832
- /**
833
- * An action that the program runner can execute
834
- */
835
- export type ProgramRunnerAction =
836
- | {
837
- WriteFile: GeneratedFile;
838
- }
839
- | {
840
- RunProgram: RunProgramRequest;
841
- }
842
- | {
843
- RunSavedProgram: RunSavedProgramRequest;
844
- };
845
- export type ResponseGenerationUpdate =
846
- | {
847
- Started: {
848
- started_at: string;
849
- };
850
- }
851
- | {
852
- GeneratedResponse: {
853
- response: ComponentResponse;
854
- generated_at: string;
855
- llm_usage?: LlmUsage[];
856
- };
857
- }
858
- | {
859
- Completed: {
860
- completed_at: string;
861
- };
862
- };
863
- /**
864
- * Updates from the confidence analysis process
865
- *
866
- * Confidence analysis evaluates how well-supported the agent's assumptions
867
- * and work are based on available knowledge sources.
868
- */
869
- export type ConfidenceAnalysisUpdate =
870
- | {
871
- Started: {
872
- /**
873
- * When the analysis began
874
- */
875
- started_at: string;
876
- };
877
- }
878
- | {
879
- Errored: {
880
- /**
881
- * The error that occurred
882
- */
883
- error: string;
884
- /**
885
- * When the error occurred
886
- */
887
- errored_at: string;
888
- };
889
- }
890
- | {
891
- Completed: {
892
- analysis: ConfidenceAnalysis;
893
- /**
894
- * When the analysis completed
895
- */
896
- completed_at: string;
897
- /**
898
- * LLM usage during the analysis process
899
- */
900
- llm_usage?: ConfidenceAnalysisLlmUsage | null;
901
- };
902
- };
903
- /**
904
- * A source of factual information used for assumption verification
905
- *
906
- * Represents different types of knowledge sources that can be used
907
- * to verify or contradict assumptions made by the agent.
908
- */
909
- export type FactSource =
910
- | {
911
- /**
912
- * The relevant content from system instructions
913
- */
914
- content: string;
915
- source_type: "system_instructions";
916
- }
917
- | {
918
- /**
919
- * Title of the wiki page
920
- */
921
- title: string;
922
- /**
923
- * Relevant content from the wiki page
924
- */
925
- content: string;
926
- source_type: "wiki";
927
- };
928
- export type WikiGenerationUpdate =
929
- | {
930
- Started: {
931
- started_at: string;
932
- };
933
- }
934
- | {
935
- Errored: {
936
- errored_at: string;
937
- error: string;
938
- };
939
- }
940
- | {
941
- Completed: {
942
- completed_at: string;
943
- wiki_delta?: WikiDelta | null;
944
- llm_usages: LlmUsage[];
945
- };
946
- };
947
- export type WikiChange =
948
- | {
949
- AddedPage: {
950
- page: WikiPageV1;
951
- };
952
- }
953
- | {
954
- ModifiedPage: {
955
- page_title: WikiTitle;
956
- modified_page: WikiPageV1;
957
- };
958
- }
959
- | {
960
- DeletedPage: {
961
- page_title: WikiTitle;
962
- };
963
- };
964
- /**
965
- * The title of a wiki page or section
966
- */
967
- export type WikiTitle = string;
968
- /**
969
- * The markdown content of block or section in a wiki page
970
- */
971
- export type WikiContent = string;
972
- /**
973
- * Final status update indicating how an agent interaction ended
974
- *
975
- * This represents the terminal state of an agent interaction, indicating
976
- * whether it completed successfully, encountered an error, was cancelled,
977
- * or was declined by the agent.
978
- */
979
- export type InteractionFinishedUpdate =
980
- | {
981
- Completed: {
982
- /**
983
- * When the interaction finished
984
- */
985
- completed_at: string;
986
- /**
987
- * Any warnings generated during processing
988
- */
989
- warnings?: Warning[];
990
- };
991
- }
992
- | {
993
- Errored: {
994
- /**
995
- * The error that occurred
996
- */
997
- error:
998
- | "Internal"
999
- | {
1000
- User: {
1001
- /**
1002
- * The error message to show to the user
1003
- */
1004
- message: string;
1005
- };
1006
- };
1007
- /**
1008
- * When the error occurred
1009
- */
1010
- errored_at: string;
1011
- };
1012
- }
1013
- | {
1014
- UserCancelled: {
1015
- /**
1016
- * When the cancellation occurred
1017
- */
1018
- cancelled_at: string;
1019
- };
1020
- }
1021
- | {
1022
- ServerCancelled: {
1023
- /**
1024
- * When the cancellation occurred
1025
- */
1026
- cancelled_at: string;
1027
- };
1028
- }
1029
- | {
1030
- AgentDeclined: {
1031
- /**
1032
- * When the decline occurred
1033
- */
1034
- declined_at: string;
1035
- /**
1036
- * Why the interaction was declined
1037
- */
1038
- reason: "MultipleUsersAndNoPromptQlMention";
1039
- };
1040
- };
1041
- /**
1042
- * Events that are internal to the system and not connected to a particular user/agent message
1043
- */
1044
- export type InternalUpdate = {
1045
- SocialFeed: {
1046
- update: SocialFeedRatingUpdate;
1047
- };
1048
- };
1049
- /**
1050
- * Updates from the social feed rating process
1051
- *
1052
- * Social feed rating analyzes thread interactions to determine if they
1053
- * contain valuable content worth featuring in a social feed.
1054
- */
1055
- export type SocialFeedRatingUpdate =
1056
- | {
1057
- Started: {
1058
- /**
1059
- * When the rating process began
1060
- */
1061
- started_at: string;
1062
- };
1063
- }
1064
- | {
1065
- Errored: {
1066
- /**
1067
- * The error that occurred
1068
- */
1069
- error: string;
1070
- /**
1071
- * When the error occurred
1072
- */
1073
- errored_at: string;
1074
- };
1075
- }
1076
- | {
1077
- Completed: {
1078
- /**
1079
- * The rating decision for this thread
1080
- */
1081
- rating:
1082
- | {
1083
- /**
1084
- * A unique index for a user message in a thread
1085
- */
1086
- selected_user_message_id: string;
1087
- /**
1088
- * A gerund that describes the nature of the conversation (e.g., "analyzing", "debugging")
1089
- */
1090
- action_verb: string;
1091
- /**
1092
- * A concise phrase (3-10 words) capturing what the thread is about
1093
- */
1094
- topic_summary: string;
1095
- /**
1096
- * Explanation for why this message was selected
1097
- */
1098
- reason: string;
1099
- type: "Chosen";
1100
- }
1101
- | {
1102
- /**
1103
- * Explanation for why no message was selected
1104
- */
1105
- reason: string;
1106
- type: "NoneChosen";
1107
- };
1108
- /**
1109
- * When the rating was completed
1110
- */
1111
- completed_at: string;
1112
- /**
1113
- * LLM usage during the rating process
1114
- */
1115
- llm_usage?: SocialFeedRatingLlmUsage | null;
1116
- };
1117
- };
1118
- export type WikiExplorerState =
1119
- | "NotStarted"
1120
- | {
1121
- Started: {
1122
- started_at: string;
1123
- };
1124
- }
1125
- | {
1126
- WikiInfoGenerated: {
1127
- wiki_summary: string;
1128
- wiki_page_ids: string[];
1129
- generated_at: string;
1130
- };
1131
- }
1132
- | {
1133
- Completed: {
1134
- wiki_summary: string;
1135
- wiki_page_ids: string[];
1136
- completed_at: string;
1137
- };
1138
- };
1139
- export type PlanningDecisionState =
1140
- | "NotStarted"
1141
- | {
1142
- Started: {
1143
- started_at: string;
1144
- };
1145
- }
1146
- | {
1147
- PlanningDecision: {
1148
- planning_required: boolean;
1149
- explanation: string;
1150
- generated_at: string;
1151
- };
1152
- }
1153
- | {
1154
- Completed: {
1155
- planning_required: boolean;
1156
- explanation: string;
1157
- completed_at: string;
1158
- };
1159
- };
1160
- export type ContextExplorerState =
1161
- | "NotStarted"
1162
- | {
1163
- SchemaTasksGenerationInProgress: {
1164
- schema_tasks_generator_state: SchemaTasksGenerationState;
1165
- };
1166
- }
1167
- | {
1168
- SchemaExplorationInProgress: {
1169
- schema_tasks_generator_state: SchemaTasksGenerationState;
1170
- schema_explorer_state: SchemaExplorerState;
1171
- };
1172
- }
1173
- | {
1174
- Completed: {
1175
- schema_tasks_generator_state: SchemaTasksGenerationState;
1176
- schema_explorer_state: SchemaExplorerState;
1177
- completed_at: string;
1178
- };
1179
- };
1180
- export type SchemaTasksGenerationState =
1181
- | "NotStarted"
1182
- | {
1183
- Started: {
1184
- started_at: string;
1185
- };
1186
- }
1187
- | {
1188
- TasksGenerated: {
1189
- generated_at: string;
1190
- tasks: string[];
1191
- };
1192
- }
1193
- | {
1194
- Completed: {
1195
- tasks: string[];
1196
- completed_at: string;
1197
- };
1198
- };
1199
- export type SchemaExplorerState =
1200
- | "NotStarted"
1201
- | {
1202
- Started: {
1203
- started_at: string;
1204
- };
1205
- }
1206
- | {
1207
- GeneratedCode: {
1208
- artifact_name: string;
1209
- code: string;
1210
- generated_at: string;
1211
- previous_analyzed_actions: AnalyzedCodeAction[];
1212
- };
1213
- }
1214
- | {
1215
- ExecutedCode: {
1216
- previous_analyzed_actions: AnalyzedCodeAction[];
1217
- current_code_action: CodeAction;
1218
- executed_at: string;
1219
- };
1220
- }
1221
- | {
1222
- AnalyzedCode: {
1223
- analyzed_actions: AnalyzedCodeAction[];
1224
- analyzed_at: string;
1225
- };
1226
- }
1227
- | {
1228
- SchemaContextRetrieved: {
1229
- analyzed_actions: AnalyzedCodeAction[];
1230
- schema_context: SchemaContext1;
1231
- retrieved_at: string;
1232
- };
1233
- }
1234
- | {
1235
- Completed: {
1236
- analyzed_actions: AnalyzedCodeAction[];
1237
- schema_context: SchemaContext1;
1238
- completed_at: string;
1239
- };
1240
- };
1241
- export type StepState =
1242
- | {
1243
- Programmer: ProgrammerState;
1244
- }
1245
- | {
1246
- UiProgrammer: UiProgrammerState;
1247
- }
1248
- | {
1249
- SavedProgramRunner: SavedProgramRunnerState;
1250
- };
1251
- /**
1252
- * Represents the current action state in the programmer workflow.
1253
- * This enum captures only the meaningful persisted states.
1254
- *
1255
- * State flow:
1256
- * None → `GeneratedCode` → `ExecutedCode` → `AnalyzedOutput` → (decision) → None or `GeneratedSummary`
1257
- *
1258
- * When `current_action` is None, the programmer is ready to generate code or summary.
1259
- */
1260
- export type CurrentAction =
1261
- | {
1262
- GeneratedCode: CodeAction2;
1263
- }
1264
- | {
1265
- ExecutedCode: CodeAction2;
1266
- }
1267
- | {
1268
- AnalyzedOutput: {
1269
- code: CodeAction2;
1270
- analysis: CodeOutputAnalysis1;
1271
- };
1272
- }
1273
- | {
1274
- GeneratedSummary: SummaryAction;
1275
- };
1276
- export type UiProgrammerState =
1277
- | "NotStarted"
1278
- | {
1279
- GeneratedCode: {
1280
- previous_builds: UiBuild[];
1281
- generated_code: GeneratedUiCode1;
1282
- };
1283
- }
1284
- | {
1285
- UiBuildCompleted: {
1286
- previous_builds: UiBuild[];
1287
- build: UiBuild;
1288
- };
1289
- }
1290
- | {
1291
- Completed: {
1292
- previous_builds: UiBuild[];
1293
- build: UiBuild2;
1294
- component_response: ComponentResponse;
1295
- llm_usage: LlmUsage[];
1296
- };
1297
- }
1298
- | {
1299
- FailedTooManyRetries: {
1300
- previous_builds: UiBuild[];
1301
- component_response: ComponentResponse;
1302
- };
1303
- };
1304
- /**
1305
- * Result of attempting to build a user interface
1306
- *
1307
- * Indicates whether the UI build process succeeded or failed,
1308
- * with appropriate details for each case.
1309
- */
1310
- export type UiBuildResult =
1311
- | {
1312
- Success: BuiltUi;
1313
- }
1314
- | {
1315
- Failure: UiBuildFailure;
1316
- };
1317
- /**
1318
- * An action that the program runner can execute
1319
- */
1320
- export type ProgramRunnerAction2 =
1321
- | {
1322
- WriteFile: GeneratedFile2;
1323
- }
1324
- | {
1325
- RunProgram: RunProgramRequest2;
1326
- }
1327
- | {
1328
- RunSavedProgram: RunSavedProgramRequest2;
1329
- };
1330
- /**
1331
- * A step in the execution pipeline
1332
- */
1333
- export type Step = PythonStep | SqlStep | UiBuildStep | PipelineStep;
1334
- /**
1335
- * Program Package Name is the unique name for a program within a project that usable from code
1336
- * Follows the database constraint: ^[a-z][a-z0-9_]*$
1337
- */
1338
- export type ProgramPackageName = string;
1339
- /**
1340
- * Data source configuration
1341
- */
1342
- export type PipelineSource = SqlSource;
1343
- /**
1344
- * Transform configuration
1345
- */
1346
- export type PipelineTransform = ProgramTransform;
1347
- /**
1348
- * Sink configuration
1349
- */
1350
- export type PipelineSink = ShelfSink;
1351
- /**
1352
- * Column type
1353
- */
1354
- export type PipelineColumnType =
1355
- | "string"
1356
- | "integer"
1357
- | "number"
1358
- | "boolean"
1359
- | "timestamp";
1360
- /**
1361
- * Partition transform
1362
- */
1363
- export type PipelinePartitionTransform =
1364
- | ("identity" | "year" | "month" | "day" | "hour")
1365
- | {
1366
- bucket: {
1367
- num_buckets: number;
1368
- };
1369
- }
1370
- | {
1371
- truncate: {
1372
- width: number;
1373
- };
1374
- };
1375
- /**
1376
- * The result of processing an action
1377
- */
1378
- export type ProgramRunnerActionResult =
1379
- | "WriteFile"
1380
- | {
1381
- RunProgram: ProgramRunResult;
1382
- }
1383
- | {
1384
- RunSavedProgram: ProgramRunResult;
1385
- };
1386
- export type ProgramRunEvent =
1387
- | RunStarted
1388
- | StepExecutionStarted
1389
- | DataArtifactUpdated
1390
- | OutputEmitted
1391
- | CodeError
1392
- | SqlError
1393
- | BuildError
1394
- | ArtifactError
1395
- | StepExecutionFinished
1396
- | RunFinished;
1397
- export type RunStarted = {
1398
- type: "RunStarted";
1399
- } & RunStartedV1;
1400
- export type StepExecutionStarted = {
1401
- type: "StepExecutionStarted";
1402
- } & StepExecutionStartedV1;
1403
- export type RunStepDetails =
1404
- | PythonRunStepDetails
1405
- | SqlRunStepDetails
1406
- | UiBuildRunStepDetails
1407
- | PipelineRunStepDetails;
1408
- /**
1409
- * A unique identifier for a `PromptQL` Program
1410
- */
1411
- export type ProgramId = string;
1412
- export type DataArtifactUpdated = {
1413
- type: "DataArtifactUpdated";
1414
- } & DataArtifactUpdatedV1;
1415
- export type ArtifactType2 =
1416
- | "table"
1417
- | "text"
1418
- | "visualization"
1419
- | "automation"
1420
- | "python_code"
1421
- | "python_package"
1422
- | "html"
1423
- | "file";
1424
- export type OutputEmitted = {
1425
- type: "OutputEmitted";
1426
- } & OutputEmittedV1;
1427
- export type CodeError = {
1428
- type: "CodeError";
1429
- } & CodeErrorV1;
1430
- export type SqlError = {
1431
- type: "SqlError";
1432
- } & SqlErrorV1;
1433
- export type BuildError = {
1434
- type: "BuildError";
1435
- } & BuildErrorV1;
1436
- export type ArtifactError = {
1437
- type: "ArtifactError";
1438
- } & ArtifactErrorV1;
1439
- export type StepExecutionFinished = {
1440
- type: "StepExecutionFinished";
1441
- } & StepExecutionFinishedV1;
1442
- export type RunFinished = {
1443
- type: "RunFinished";
1444
- } & RunFinishedV1;
1445
- export type RunFinishedOutcome =
1446
- | {
1447
- type: "Success";
1448
- }
1449
- | {
1450
- error: string;
1451
- type: "Error";
1452
- }
1453
- | {
1454
- type: "UserCancelled";
1455
- };
1456
- /**
1457
- * Stage of the saved program runner state machine
1458
- */
1459
- export type SavedProgramRunnerStage =
1460
- | "NotStarted"
1461
- | {
1462
- GeneratedOutput: {
1463
- generated_output: GeneratedProgramRunnerOutput;
1464
- };
1465
- }
1466
- | {
1467
- ProgramRunDueToStart: {
1468
- current_attempt: ProgramRunnerAttempt;
1469
- /**
1470
- * Index of the run that just completed
1471
- */
1472
- action_index: number;
1473
- };
1474
- }
1475
- | {
1476
- ProgramRunCompleted: {
1477
- current_attempt: ProgramRunnerAttempt;
1478
- /**
1479
- * Index of the run that just completed
1480
- */
1481
- action_index: number;
1482
- };
1483
- }
1484
- | {
1485
- Completed: {
1486
- final_attempt: ProgramRunnerAttempt;
1487
- component_response: ComponentResponse;
1488
- llm_usage: LlmUsage[];
1489
- };
1490
- }
1491
- | {
1492
- FailedTooManyRetries: {
1493
- component_response: ComponentResponse;
1494
- };
1495
- };
1496
- export type ResponseGenerationState =
1497
- | "NotStarted"
1498
- | {
1499
- Started: {
1500
- started_at: string;
1501
- };
1502
- }
1503
- | {
1504
- ResponseGenerated: {
1505
- response: ComponentResponse;
1506
- generated_at: string;
1507
- };
1508
- }
1509
- | {
1510
- Completed: {
1511
- response: ComponentResponse;
1512
- completed_at: string;
1513
- };
1514
- };
1515
- export type InteractionOutcome =
1516
- | {
1517
- Completed: {
1518
- completed_at: string;
1519
- };
1520
- }
1521
- | {
1522
- Errored: {
1523
- errored_at: string;
1524
- };
1525
- }
1526
- | {
1527
- UserCancelled: {
1528
- cancelled_at: string;
1529
- };
1530
- }
1531
- | {
1532
- AgentDeclined: {
1533
- declined_at: string;
1534
- reason: InteractionDeclineReason;
1535
- };
1536
- }
1537
- | {
1538
- ServerCancelled: {
1539
- cancelled_at: string;
1540
- };
1541
- };
1542
- /**
1543
- * Reasons why an agent might decline to process a user interaction
1544
- */
1545
- export type InteractionDeclineReason = "MultipleUsersAndNoPromptQlMention";
1546
- export type ConfidenceAnalysisOutcome =
1547
- | {
1548
- Completed: {
1549
- completed_at: string;
1550
- analysis: ConfidenceAnalysis1;
1551
- };
1552
- }
1553
- | {
1554
- Errored: {
1555
- errored_at: string;
1556
- error: string;
1557
- };
1558
- };
1559
- export type SocialFeedRatingOutcome =
1560
- | {
1561
- Completed: {
1562
- completed_at: string;
1563
- rating: SocialFeedRating;
1564
- };
1565
- }
1566
- | {
1567
- Errored: {
1568
- errored_at: string;
1569
- error: string;
1570
- };
1571
- };
1572
- /**
1573
- * Rating of a thread interaction for social feed display
1574
- *
1575
- * Evaluates whether an interaction is interesting or valuable enough
1576
- * to be featured in a social feed, helping surface the best content.
1577
- */
1578
- export type SocialFeedRating =
1579
- | {
1580
- /**
1581
- * A unique index for a user message in a thread
1582
- */
1583
- selected_user_message_id: string;
1584
- /**
1585
- * A gerund that describes the nature of the conversation (e.g., "analyzing", "debugging")
1586
- */
1587
- action_verb: string;
1588
- /**
1589
- * A concise phrase (3-10 words) capturing what the thread is about
1590
- */
1591
- topic_summary: string;
1592
- /**
1593
- * Explanation for why this message was selected
1594
- */
1595
- reason: string;
1596
- type: "Chosen";
1597
- }
1598
- | {
1599
- /**
1600
- * Explanation for why no message was selected
1601
- */
1602
- reason: string;
1603
- type: "NoneChosen";
1604
- };
1605
- export type WikiGenerationOutcome =
1606
- | {
1607
- Completed: {
1608
- completed_at: string;
1609
- wiki_delta?: WikiDelta | null;
1610
- };
1611
- }
1612
- | {
1613
- Errored: {
1614
- errored_at: string;
1615
- error: string;
1616
- };
1617
- };
1618
-
1619
- export interface AllTheServerTypes {
1620
- version_response: Version;
1621
- thread_event: ThreadEvent;
1622
- agent_state: AgentState;
1623
- }
1624
- export interface Version {
1625
- version: string;
1626
- }
1627
- /**
1628
- * A chat message sent by a user
1629
- */
1630
- export interface UserMessage {
1631
- timestamp: string;
1632
- message: string;
1633
- uploads: UserUpload[];
1634
- timezone: string;
1635
- }
1636
- /**
1637
- * A file or data artifact uploaded by a user as part of their message
1638
- */
1639
- export interface UserUpload {
1640
- /**
1641
- * Name of the artifact as provided by user, usually the filename
1642
- */
1643
- artifact_name: string;
1644
- artifact_reference: ArtifactReference;
1645
- }
1646
- /**
1647
- * Reference to an uploaded thread artifact
1648
- */
1649
- export interface ArtifactReference {
1650
- artifact_id: ArtifactId;
1651
- version: number;
1652
- }
1653
- /**
1654
- * Language model usage statistics
1655
- *
1656
- * Tracks token usage and model information for LLM calls made during
1657
- * agent processing, used for monitoring, billing, and performance analysis.
1658
- */
1659
- export interface LlmUsage {
1660
- /**
1661
- * The LLM provider (e.g., "openai", "anthropic")
1662
- */
1663
- provider: string;
1664
- /**
1665
- * The specific model used (e.g., "gpt-4", "claude-3-sonnet")
1666
- */
1667
- model: string;
1668
- /**
1669
- * Number of input tokens sent to the model
1670
- */
1671
- input_tokens: number;
1672
- /**
1673
- * Number of output tokens generated by the model
1674
- */
1675
- output_tokens: number;
1676
- /**
1677
- * Number of cached tokens (if supported by the provider)
1678
- */
1679
- cached_tokens?: number | null;
1680
- /**
1681
- * Number of cache creation tokens (defaults to 0 if not supported by the provider)
1682
- */
1683
- cache_creation_tokens?: number;
1684
- /**
1685
- * Number of thinking (reasoning) tokens generated by the model
1686
- */
1687
- thinking_tokens?: number;
1688
- }
1689
- /**
1690
- * A segment of processed user message text with associated metadata
1691
- *
1692
- * Spans break down the user's message into meaningful segments, each with
1693
- * a link that provides context about how that segment should be interpreted.
1694
- */
1695
- export interface Span {
1696
- /**
1697
- * The text content of this span
1698
- */
1699
- text: string;
1700
- /**
1701
- * Metadata about how this span should be interpreted
1702
- */
1703
- link:
1704
- | {
1705
- ChatHistory: {
1706
- /**
1707
- * Definition or context from the chat history
1708
- */
1709
- definition: string;
1710
- };
1711
- }
1712
- | "NotRequired"
1713
- | {
1714
- WikiPage: {
1715
- /**
1716
- * Unique identifier for the wiki page
1717
- */
1718
- wiki_page_id: string;
1719
- /**
1720
- * Title of the wiki page
1721
- */
1722
- title: string;
1723
- /**
1724
- * Definition or excerpt from the wiki page
1725
- */
1726
- definition?: string | null;
1727
- /**
1728
- * Alternative names for this concept
1729
- */
1730
- aliases: string[];
1731
- };
1732
- }
1733
- | {
1734
- AssumeDefinition: {
1735
- /**
1736
- * The assumed definition for this span
1737
- */
1738
- definition: string;
1739
- };
1740
- }
1741
- | {
1742
- NotFound: {};
1743
- };
1744
- }
1745
- /**
1746
- * Analysis of the code output
1747
- */
1748
- export interface CodeOutputAnalysis {
1749
- /**
1750
- * Analysis about the code output
1751
- */
1752
- analysis: string;
1753
- /**
1754
- * Suggested next steps based on the analysis.
1755
- */
1756
- next_steps?: string | null;
1757
- }
1758
- /**
1759
- * The processed schema context information
1760
- */
1761
- export interface SchemaContext {
1762
- schema_tasks: SchemaTask[];
1763
- schema_exploration_successful: boolean;
1764
- }
1765
- export interface SchemaTask {
1766
- task: string;
1767
- analysis?: string | null;
1768
- }
1769
- export interface ArtifactUpdate {
1770
- identifier: string;
1771
- title: string;
1772
- artifact_type: ArtifactType;
1773
- data?: ArtifactPreview | null;
1774
- artifact_reference: ArtifactReference1;
1775
- }
1776
- export interface ArtifactReference1 {
1777
- artifact_id: ArtifactId;
1778
- version: number;
1779
- }
1780
- export interface ShelfUpdateV1 {
1781
- transaction_id: TransactionId;
1782
- event: ShelfActionEvent;
1783
- }
1784
- /**
1785
- * A response generated by a component for the user
1786
- *
1787
- * Contains a message explaining what was accomplished, any artifacts
1788
- * that were created or modified, and whether the operation was successful.
1789
- */
1790
- export interface ComponentResponse {
1791
- /**
1792
- * The message to display to the user
1793
- */
1794
- message: string;
1795
- /**
1796
- * List of artifacts that were created or modified
1797
- */
1798
- modified_artifacts: ArtifactUpdate[];
1799
- /**
1800
- * Whether the operation completed successfully
1801
- */
1802
- success: boolean;
1803
- /**
1804
- * When this response was generated
1805
- */
1806
- generated_at: string;
1807
- }
1808
- /**
1809
- * The generated UI code and metadata
1810
- */
1811
- export interface GeneratedUiCode {
1812
- /**
1813
- * Metadata about the UI (title, artifact name, etc.).
1814
- * This is an Option only for historic reasons when we didn't always make the ui metadata mandatory for the LLM to generate
1815
- */
1816
- ui_metadata?: UiMetadata | null;
1817
- /**
1818
- * The generated TypeScript/React code
1819
- */
1820
- tsx_code?: string | null;
1821
- /**
1822
- * The generated CSS styling code
1823
- */
1824
- css_code?: string | null;
1825
- /**
1826
- * Names of data artifacts that this UI imports/uses
1827
- */
1828
- imported_data_artifacts: string[];
1829
- /**
1830
- * When this code was generated
1831
- */
1832
- generated_at: string;
1833
- /**
1834
- * LLM usage during code generation
1835
- */
1836
- llm_usage?: LlmUsage[];
1837
- }
1838
- /**
1839
- * Metadata about a generated user interface
1840
- *
1841
- * Contains descriptive information about the UI that helps identify
1842
- * and organize it within the system.
1843
- */
1844
- export interface UiMetadata {
1845
- /**
1846
- * Human-readable title for the UI
1847
- */
1848
- title: string;
1849
- /**
1850
- * Unique name for the artifact containing this UI
1851
- */
1852
- artifact_name: string;
1853
- }
1854
- /**
1855
- * A successfully built user interface
1856
- *
1857
- * Contains the final artifact and metadata about when the UI was built.
1858
- */
1859
- export interface BuiltUi {
1860
- artifact: ArtifactUpdate1;
1861
- /**
1862
- * When the UI was successfully built
1863
- */
1864
- built_at: string;
1865
- }
1866
- /**
1867
- * The artifact containing the built UI
1868
- */
1869
- export interface ArtifactUpdate1 {
1870
- identifier: string;
1871
- title: string;
1872
- artifact_type: ArtifactType;
1873
- data?: ArtifactPreview | null;
1874
- artifact_reference: ArtifactReference1;
1875
- }
1876
- /**
1877
- * Details about a failed UI build attempt
1878
- *
1879
- * Contains error information and timing for debugging build failures.
1880
- */
1881
- export interface UiBuildFailure {
1882
- /**
1883
- * The error message describing why the build failed
1884
- */
1885
- build_error: string;
1886
- /**
1887
- * When the build failure occurred
1888
- */
1889
- built_at: string;
1890
- }
1891
- /**
1892
- * A successfully built user interface
1893
- *
1894
- * Contains the final artifact and metadata about when the UI was built.
1895
- */
1896
- export interface BuiltUi1 {
1897
- artifact: ArtifactUpdate1;
1898
- /**
1899
- * When the UI was successfully built
1900
- */
1901
- built_at: string;
1902
- }
1903
- /**
1904
- * A response generated by a component for the user
1905
- *
1906
- * Contains a message explaining what was accomplished, any artifacts
1907
- * that were created or modified, and whether the operation was successful.
1908
- */
1909
- export interface ComponentResponse1 {
1910
- /**
1911
- * The message to display to the user
1912
- */
1913
- message: string;
1914
- /**
1915
- * List of artifacts that were created or modified
1916
- */
1917
- modified_artifacts: ArtifactUpdate[];
1918
- /**
1919
- * Whether the operation completed successfully
1920
- */
1921
- success: boolean;
1922
- /**
1923
- * When this response was generated
1924
- */
1925
- generated_at: string;
1926
- }
1927
- /**
1928
- * A response generated by a component for the user
1929
- *
1930
- * Contains a message explaining what was accomplished, any artifacts
1931
- * that were created or modified, and whether the operation was successful.
1932
- */
1933
- export interface ComponentResponse2 {
1934
- /**
1935
- * The message to display to the user
1936
- */
1937
- message: string;
1938
- /**
1939
- * List of artifacts that were created or modified
1940
- */
1941
- modified_artifacts: ArtifactUpdate[];
1942
- /**
1943
- * Whether the operation completed successfully
1944
- */
1945
- success: boolean;
1946
- /**
1947
- * When this response was generated
1948
- */
1949
- generated_at: string;
1950
- }
1951
- /**
1952
- * A file generated by the LLM for program execution
1953
- */
1954
- export interface GeneratedFile {
1955
- /**
1956
- * Name of the file (e.g., ``prepare_input.py``)
1957
- */
1958
- file_name: string;
1959
- /**
1960
- * Content of the file
1961
- */
1962
- content: string;
1963
- }
1964
- /**
1965
- * Configuration for running a custom program from LLM output
1966
- */
1967
- export interface RunProgramRequest {
1968
- /**
1969
- * File references for this run (references files from generated output)
1970
- */
1971
- files: string[];
1972
- /**
1973
- * The run configuration (steps to execute, serialized as JSON for decoupling from programs crate)
1974
- */
1975
- run_config: {
1976
- [k: string]: unknown;
1977
- };
1978
- }
1979
- /**
1980
- * Configuration for running a saved program from LLM output
1981
- */
1982
- export interface RunSavedProgramRequest {
1983
- /**
1984
- * The package name of the saved program to run
1985
- */
1986
- program_package_name: string;
1987
- /**
1988
- * The entry point file (e.g., "default.run.json")
1989
- */
1990
- entry_point: string;
1991
- }
1992
- /**
1993
- * A response generated by a component for the user
1994
- *
1995
- * Contains a message explaining what was accomplished, any artifacts
1996
- * that were created or modified, and whether the operation was successful.
1997
- */
1998
- export interface ComponentResponse3 {
1999
- /**
2000
- * The message to display to the user
2001
- */
2002
- message: string;
2003
- /**
2004
- * List of artifacts that were created or modified
2005
- */
2006
- modified_artifacts: ArtifactUpdate[];
2007
- /**
2008
- * Whether the operation completed successfully
2009
- */
2010
- success: boolean;
2011
- /**
2012
- * When this response was generated
2013
- */
2014
- generated_at: string;
2015
- }
2016
- /**
2017
- * A response generated by a component for the user
2018
- *
2019
- * Contains a message explaining what was accomplished, any artifacts
2020
- * that were created or modified, and whether the operation was successful.
2021
- */
2022
- export interface ComponentResponse4 {
2023
- /**
2024
- * The message to display to the user
2025
- */
2026
- message: string;
2027
- /**
2028
- * List of artifacts that were created or modified
2029
- */
2030
- modified_artifacts: ArtifactUpdate[];
2031
- /**
2032
- * Whether the operation completed successfully
2033
- */
2034
- success: boolean;
2035
- /**
2036
- * When this response was generated
2037
- */
2038
- generated_at: string;
2039
- }
2040
- /**
2041
- * A response generated by a component for the user
2042
- *
2043
- * Contains a message explaining what was accomplished, any artifacts
2044
- * that were created or modified, and whether the operation was successful.
2045
- */
2046
- export interface ComponentResponse5 {
2047
- /**
2048
- * The message to display to the user
2049
- */
2050
- message: string;
2051
- /**
2052
- * List of artifacts that were created or modified
2053
- */
2054
- modified_artifacts: ArtifactUpdate[];
2055
- /**
2056
- * Whether the operation completed successfully
2057
- */
2058
- success: boolean;
2059
- /**
2060
- * When this response was generated
2061
- */
2062
- generated_at: string;
2063
- }
2064
- /**
2065
- * The completed confidence analysis
2066
- */
2067
- export interface ConfidenceAnalysis {
2068
- /**
2069
- * The agent's understanding of what the user wanted to accomplish
2070
- */
2071
- user_goal_for_latest_interaction: string;
2072
- /**
2073
- * Business topics and their fact-checked assumptions
2074
- */
2075
- artifact_assumptions: CheckedTopic[];
2076
- }
2077
- /**
2078
- * A business topic with its associated fact-checked assumptions
2079
- *
2080
- * Groups related assumptions under a common topic for better organization
2081
- * and analysis of the agent's understanding.
2082
- */
2083
- export interface CheckedTopic {
2084
- /**
2085
- * The business topic or domain area
2086
- */
2087
- topic: string;
2088
- /**
2089
- * List of assumptions related to this topic that have been fact-checked
2090
- */
2091
- assumptions: CheckedAssumption[];
2092
- }
2093
- /**
2094
- * An assumption that has been fact-checked against available knowledge
2095
- *
2096
- * Contains the original assumption text and the results of verifying
2097
- * it against system instructions, wiki pages, and other sources.
2098
- */
2099
- export interface CheckedAssumption {
2100
- /**
2101
- * The assumption that was made
2102
- */
2103
- assumption: string;
2104
- fact_check: AssumptionFactCheck;
2105
- }
2106
- /**
2107
- * Results of fact-checking this assumption
2108
- */
2109
- export interface AssumptionFactCheck {
2110
- /**
2111
- * The assumption that was fact-checked
2112
- */
2113
- assumption: string;
2114
- /**
2115
- * Sources that provide evidence for or against this assumption
2116
- */
2117
- supporting_facts?: FactSource[];
2118
- /**
2119
- * Whether this assumption is fully supported by available facts
2120
- */
2121
- fully_backed_by_facts: boolean;
2122
- /**
2123
- * Additional explanation about the fact-checking results
2124
- */
2125
- explanation?: string | null;
2126
- }
2127
- /**
2128
- * LLM usage breakdown for confidence analysis
2129
- *
2130
- * Tracks language model usage across the different phases of confidence analysis.
2131
- */
2132
- export interface ConfidenceAnalysisLlmUsage {
2133
- /**
2134
- * LLM usage for identifying business topics
2135
- */
2136
- business_topics: LlmUsage[];
2137
- /**
2138
- * LLM usage for generating assumptions
2139
- */
2140
- assumptions: LlmUsage[];
2141
- /**
2142
- * LLM usage for fact-checking assumptions
2143
- */
2144
- fact_check: LlmUsage[];
2145
- }
2146
- export interface WikiDelta {
2147
- changes: WikiChange[];
2148
- nudge_text: string;
2149
- }
2150
- /**
2151
- * Definition of a wiki page
2152
- */
2153
- export interface WikiPageV1 {
2154
- /**
2155
- * The title of the wiki page
2156
- */
2157
- title: WikiTitle;
2158
- /**
2159
- * The alias titles of the wiki page
2160
- */
2161
- aliases?: WikiTitle[];
2162
- /**
2163
- * Whether this is a stub page
2164
- */
2165
- stub?: boolean;
2166
- /**
2167
- * The definition of the topic of the wiki page
2168
- */
2169
- definition?: WikiContent | null;
2170
- /**
2171
- * Detailed information about the topic of the wiki page
2172
- */
2173
- details?: WikiContent | null;
2174
- /**
2175
- * Additional sections for related topics of the wiki page
2176
- */
2177
- sections?: WikiSection[];
2178
- }
2179
- /**
2180
- * Definition of a section inside a wiki page
2181
- */
2182
- export interface WikiSection {
2183
- /**
2184
- * The title of the section
2185
- */
2186
- title: WikiTitle;
2187
- /**
2188
- * The markdown content of the section
2189
- */
2190
- content: WikiContent;
2191
- }
2192
- /**
2193
- * A warning message generated during agent processing
2194
- *
2195
- * Warnings indicate potential issues or important information that doesn't
2196
- * prevent the interaction from completing but should be brought to the user's attention.
2197
- */
2198
- export interface Warning {
2199
- /**
2200
- * The warning message to display to the user
2201
- */
2202
- message: string;
2203
- }
2204
- /**
2205
- * A request from a user to cancel a running agent interaction
2206
- */
2207
- export interface UserCancel {
2208
- /**
2209
- * When the cancellation request was made
2210
- */
2211
- timestamp: string;
2212
- }
2213
- /**
2214
- * LLM usage for social feed rating analysis
2215
- *
2216
- * Tracks language model usage during the social feed rating process.
2217
- */
2218
- export interface SocialFeedRatingLlmUsage {
2219
- /**
2220
- * LLM usage for analyzing and rating the thread content
2221
- */
2222
- rating: LlmUsage[];
2223
- }
2224
- export interface AgentState {
2225
- title?: string | null;
2226
- interactions: Interaction[];
2227
- thread_participants: ThreadParticipants;
2228
- /**
2229
- * A unique index for a user message in a thread
2230
- */
2231
- current_user_message_id: string;
2232
- /**
2233
- * A unique index for a agent message in a thread
2234
- */
2235
- current_agent_message_id: string;
2236
- /**
2237
- * Metadata for artifacts uploaded by users in messages
2238
- */
2239
- user_upload_metadata: {
2240
- [k: string]: UserUploadMetadata;
2241
- };
2242
- }
2243
- export interface Interaction {
2244
- user: UserInteraction;
2245
- agent?: AgentInteraction | null;
2246
- }
2247
- export interface UserInteraction {
2248
- /**
2249
- * A unique index for a user message in a thread
2250
- */
2251
- user_message_id: string;
2252
- user: UserMessage;
2253
- user_id: PromptQlUserId;
2254
- }
2255
- export interface AgentInteraction {
2256
- /**
2257
- * A unique index for a agent message in a thread
2258
- */
2259
- agent_message_id: string;
2260
- message_processing?: MessageProcessingState | null;
2261
- planning_decision: PlanningDecisionState;
2262
- orchestrator: OrchestratorState;
2263
- response: ResponseGenerationState;
2264
- outcome?: InteractionOutcome | null;
2265
- confidence?: ConfidenceAnalysisOutcome | null;
2266
- social_feed_rating?: SocialFeedRatingOutcome | null;
2267
- wiki_generation?: WikiGenerationOutcome | null;
2268
- }
2269
- export interface MessageProcessingState {
2270
- processed_user_message: Span[];
2271
- assumptions: string[];
2272
- clarification_request?: string | null;
2273
- completed_at?: string | null;
2274
- wiki_explorer_state?: WikiExplorerState | null;
2275
- }
2276
- export interface OrchestratorState {
2277
- context_explorer: ContextExplorerState;
2278
- plans: PlanState[];
2279
- response?: ComponentResponse | null;
2280
- }
2281
- /**
2282
- * A code action paired with its analysis.
2283
- * This represents a complete exploration iteration: code generation, execution, and analysis.
2284
- */
2285
- export interface AnalyzedCodeAction {
2286
- code_action: CodeAction;
2287
- analysis: CodeOutputAnalysis1;
2288
- }
2289
- export interface CodeAction {
2290
- artifact_name: string;
2291
- code: string;
2292
- generated_at: string;
2293
- output?: string | null;
2294
- error?: string | null;
2295
- executed_at?: string | null;
2296
- }
2297
- /**
2298
- * Analysis of code output from schema exploration
2299
- */
2300
- export interface CodeOutputAnalysis1 {
2301
- /**
2302
- * Analysis about the code output
2303
- */
2304
- analysis: string;
2305
- /**
2306
- * Suggested next steps based on the analysis.
2307
- */
2308
- next_steps?: string | null;
2309
- }
2310
- /**
2311
- * Context information about database schemas and data structures
2312
- *
2313
- * Contains processed information about available data sources,
2314
- * their structure, and relationships.
2315
- */
2316
- export interface SchemaContext1 {
2317
- schema_tasks: SchemaTask[];
2318
- schema_exploration_successful: boolean;
2319
- }
2320
- export interface PlanState {
2321
- steps: PlanStateStep[];
2322
- generation_started_at: string;
2323
- generation_completed_at?: string | null;
2324
- }
2325
- export interface PlanStateStep {
2326
- title: string;
2327
- instructions?: string | null;
2328
- generated_at: string;
2329
- execution_started_at?: string | null;
2330
- state: StepState;
2331
- }
2332
- export interface ProgrammerState {
2333
- /**
2334
- * Completed code generation cycles (code + execution + analysis)
2335
- */
2336
- completed_actions: AnalyzedCodeAction2[];
2337
- /**
2338
- * Current action state (Code, Analysis, or Summary)
2339
- */
2340
- current_action?: CurrentAction | null;
2341
- response?: ComponentResponse | null;
2342
- }
2343
- /**
2344
- * A code action paired with its analysis.
2345
- * This represents a complete iteration: code generation, execution, and analysis.
2346
- */
2347
- export interface AnalyzedCodeAction2 {
2348
- code_action: CodeAction2;
2349
- analysis: CodeOutputAnalysis1;
2350
- }
2351
- export interface CodeAction2 {
2352
- artifact_name: string;
2353
- code: string;
2354
- generated_at: string;
2355
- code_output?: string | null;
2356
- code_execution_error?: string | null;
2357
- code_execution_started_at?: string | null;
2358
- code_executed_at?: string | null;
2359
- accessed_artifacts: string[];
2360
- modified_artifacts: ArtifactUpdate[];
2361
- }
2362
- export interface SummaryAction {
2363
- response: string;
2364
- success: boolean;
2365
- generated_at: string;
2366
- }
2367
- export interface UiBuild {
2368
- generated_code: GeneratedUiCode1;
2369
- build_result: UiBuildResult;
2370
- }
2371
- /**
2372
- * Generated UI code and associated metadata
2373
- *
2374
- * Contains the TypeScript/React and CSS code generated for a user interface,
2375
- * along with metadata about the UI and any data dependencies.
2376
- */
2377
- export interface GeneratedUiCode1 {
2378
- /**
2379
- * Metadata about the UI (title, artifact name, etc.).
2380
- * This is an Option only for historic reasons when we didn't always make the ui metadata mandatory for the LLM to generate
2381
- */
2382
- ui_metadata?: UiMetadata | null;
2383
- /**
2384
- * The generated TypeScript/React code
2385
- */
2386
- tsx_code?: string | null;
2387
- /**
2388
- * The generated CSS styling code
2389
- */
2390
- css_code?: string | null;
2391
- /**
2392
- * Names of data artifacts that this UI imports/uses
2393
- */
2394
- imported_data_artifacts: string[];
2395
- /**
2396
- * When this code was generated
2397
- */
2398
- generated_at: string;
2399
- /**
2400
- * LLM usage during code generation
2401
- */
2402
- llm_usage?: LlmUsage[];
2403
- }
2404
- export interface UiBuild2 {
2405
- generated_code: GeneratedUiCode1;
2406
- build_result: BuiltUi;
2407
- }
2408
- /**
2409
- * State machine for the saved program runner step
2410
- */
2411
- export interface SavedProgramRunnerState {
2412
- previous_attempts: ProgramRunnerAttempt[];
2413
- stage: SavedProgramRunnerStage;
2414
- artifact_state: ArtifactState;
2415
- }
2416
- /**
2417
- * A single attempt at running the program (may include multiple program runs)
2418
- */
2419
- export interface ProgramRunnerAttempt {
2420
- generated_output: GeneratedProgramRunnerOutput;
2421
- action_results: ProgramRunnerActionResult[];
2422
- }
2423
- /**
2424
- * Output generated by the LLM
2425
- */
2426
- export interface GeneratedProgramRunnerOutput {
2427
- /**
2428
- * Sequential list of actions to execute, preserving the order from LLM output
2429
- */
2430
- actions: ProgramRunnerAction2[];
2431
- generated_at: string;
2432
- llm_usage: LlmUsage[];
2433
- }
2434
- /**
2435
- * A file generated by the LLM
2436
- */
2437
- export interface GeneratedFile2 {
2438
- file_name: string;
2439
- content: string;
2440
- }
2441
- /**
2442
- * A program run configuration from LLM output
2443
- */
2444
- export interface RunProgramRequest2 {
2445
- files: string[];
2446
- /**
2447
- * The run configuration (steps to execute, serialized as JSON for flexibility)
2448
- */
2449
- run_config: RunConfigV1;
2450
- }
2451
- export interface RunConfigV1 {
2452
- /**
2453
- * Declare dependencies on other programs, allows importing
2454
- * their files in scripts in this program's scripts
2455
- */
2456
- dependencies?: Dependency[];
2457
- /**
2458
- * Execution pipeline, executed serially in order
2459
- */
2460
- steps: Step[];
2461
- version: "v1";
2462
- }
2463
- /**
2464
- * A dependency on another program
2465
- */
2466
- export interface Dependency {
2467
- /**
2468
- * The package name of the program to depend on
2469
- */
2470
- program: string;
2471
- }
2472
- /**
2473
- * Run a Python script
2474
- */
2475
- export interface PythonStep {
2476
- /**
2477
- * The Python file to execute
2478
- */
2479
- file: string;
2480
- /**
2481
- * Optional: the program to load the file from
2482
- * When running a script from another program, the artifacts available to it to see
2483
- * will be the artifacts in this program, not the artifacts in the other program.
2484
- * Any files from the other program will be available to the other program script.
2485
- */
2486
- program?: ProgramPackageName | null;
2487
- type: "python";
2488
- }
2489
- /**
2490
- * Run a SQL query, produces a table artifact named after the sql file (eg query.sql-results)
2491
- */
2492
- export interface SqlStep {
2493
- /**
2494
- * The SQL file to execute
2495
- */
2496
- file: string;
2497
- /**
2498
- * Optional: the program to load the file from
2499
- */
2500
- program?: ProgramPackageName | null;
2501
- type: "sql";
2502
- }
2503
- /**
2504
- * Build a UI from .tsx and .css files, produces an html artifact named after the tsx file (eg ui.tsx-results)
2505
- */
2506
- export interface UiBuildStep {
2507
- /**
2508
- * The TypeScript React file (App.tsx)
2509
- */
2510
- "App.tsx": string;
2511
- /**
2512
- * The CSS file (App.css)
2513
- */
2514
- "App.css": string;
2515
- /**
2516
- * Optional: the program to load the files from
2517
- */
2518
- program?: ProgramPackageName | null;
2519
- /**
2520
- * Optional: the name of the artifact to create
2521
- * If not specified, the name of the tsx file will be used
2522
- */
2523
- artifactName?: string | null;
2524
- /**
2525
- * Optional: the title of the artifact to create
2526
- * If not specified, the artifact name will be used
2527
- */
2528
- artifactTitle?: string | null;
2529
- type: "ui-build";
2530
- }
2531
- /**
2532
- * Run a data pipeline
2533
- */
2534
- export interface PipelineStep {
2535
- source: PipelineSource;
2536
- transform: PipelineTransform;
2537
- sink: PipelineSink;
2538
- type: "pipeline";
2539
- }
2540
- /**
2541
- * SQL query source
2542
- */
2543
- export interface SqlSource {
2544
- /**
2545
- * SQL file name
2546
- */
2547
- sql: string;
2548
- type: "sql";
2549
- }
2550
- /**
2551
- * Python program transform
2552
- */
2553
- export interface ProgramTransform {
2554
- /**
2555
- * Python source file
2556
- */
2557
- source: string;
2558
- type: "program";
2559
- }
2560
- /**
2561
- * Shelf table sink
2562
- */
2563
- export interface ShelfSink {
2564
- /**
2565
- * Table name
2566
- */
2567
- tableName: string;
2568
- schema: PipelineSchema;
2569
- /**
2570
- * Partitioning configuration
2571
- */
2572
- partitioning?: PipelinePartitionSpec[];
2573
- type: "shelf";
2574
- }
2575
- /**
2576
- * Table schema
2577
- */
2578
- export interface PipelineSchema {
2579
- /**
2580
- * Column definitions
2581
- */
2582
- columns: PipelineColumn[];
2583
- }
2584
- /**
2585
- * Pipeline column definition
2586
- */
2587
- export interface PipelineColumn {
2588
- /**
2589
- * Column name
2590
- */
2591
- name: string;
2592
- type: PipelineColumnType;
2593
- }
2594
- /**
2595
- * Pipeline partition specification
2596
- */
2597
- export interface PipelinePartitionSpec {
2598
- /**
2599
- * Partition name
2600
- */
2601
- name: string;
2602
- /**
2603
- * Column to partition on
2604
- */
2605
- column: string;
2606
- transform: PipelinePartitionTransform;
2607
- }
2608
- export interface RunSavedProgramRequest2 {
2609
- program_package_name: string;
2610
- entry_point: string;
2611
- }
2612
- /**
2613
- * Result of executing a program run
2614
- */
2615
- export interface ProgramRunResult {
2616
- started_at: string;
2617
- completed_at: string;
2618
- events: ProgramRunEvent[];
2619
- success: boolean;
2620
- output?: string | null;
2621
- error?: string | null;
2622
- modified_artifacts: ArtifactUpdate[];
2623
- }
2624
- export interface RunStartedV1 {
2625
- version: "V1";
2626
- }
2627
- export interface StepExecutionStartedV1 {
2628
- step_index: number;
2629
- step: RunStepDetails;
2630
- version: "V1";
2631
- }
2632
- export interface PythonRunStepDetails {
2633
- other_program_id?: ProgramId | null;
2634
- file: string;
2635
- type: "PythonRunStepDetails";
2636
- }
2637
- export interface SqlRunStepDetails {
2638
- other_program_id?: ProgramId | null;
2639
- file: string;
2640
- type: "SqlRunStepDetails";
2641
- }
2642
- export interface UiBuildRunStepDetails {
2643
- other_program_id?: ProgramId | null;
2644
- app_tsx: string;
2645
- app_css: string;
2646
- type: "UiBuildRunStepDetails";
2647
- }
2648
- export interface PipelineRunStepDetails {
2649
- type: "PipelineRunStepDetails";
2650
- }
2651
- export interface DataArtifactUpdatedV1 {
2652
- step_index: number;
2653
- name: string;
2654
- title: string;
2655
- artifact: ArtifactReference1;
2656
- artifact_type: ArtifactType2;
2657
- version: "V1";
2658
- }
2659
- export interface OutputEmittedV1 {
2660
- step_index: number;
2661
- output: string;
2662
- version: "V1";
2663
- }
2664
- export interface CodeErrorV1 {
2665
- step_index: number;
2666
- error: string;
2667
- version: "V1";
2668
- }
2669
- export interface SqlErrorV1 {
2670
- step_index: number;
2671
- error: string;
2672
- version: "V1";
2673
- }
2674
- export interface BuildErrorV1 {
2675
- step_index: number;
2676
- error: string;
2677
- version: "V1";
2678
- }
2679
- export interface ArtifactErrorV1 {
2680
- step_index: number;
2681
- error: string;
2682
- version: "V1";
2683
- }
2684
- export interface StepExecutionFinishedV1 {
2685
- step_index: number;
2686
- error?: string | null;
2687
- version: "V1";
2688
- }
2689
- export interface RunFinishedV1 {
2690
- outcome: RunFinishedOutcome;
2691
- version: "V1";
2692
- }
2693
- export interface ArtifactState {
2694
- [k: string]: ArtifactReference1;
2695
- }
2696
- /**
2697
- * Analysis of the agent's confidence in its understanding and work
2698
- *
2699
- * Evaluates the assumptions made during processing and fact-checks them
2700
- * against available knowledge to assess confidence in the results.
2701
- */
2702
- export interface ConfidenceAnalysis1 {
2703
- /**
2704
- * The agent's understanding of what the user wanted to accomplish
2705
- */
2706
- user_goal_for_latest_interaction: string;
2707
- /**
2708
- * Business topics and their fact-checked assumptions
2709
- */
2710
- artifact_assumptions: CheckedTopic[];
2711
- }
2712
- export interface ThreadParticipants {
2713
- user_ids: PromptQlUserId[];
2714
- }
2715
- /**
2716
- * Metadata about an uploaded artifact, fetched before agent starts
2717
- */
2718
- export interface UserUploadMetadata {
2719
- /**
2720
- * Name of the artifact as provided by user
2721
- */
2722
- artifact_name: string;
2723
- artifact_reference: ArtifactReference2;
2724
- /**
2725
- * Title of the artifact
2726
- */
2727
- title: string;
2728
- /**
2729
- * Description of the artifact (if any)
2730
- */
2731
- description?: string | null;
2732
- /**
2733
- * Type of the artifact (e.g., "table", "text", "file")
2734
- */
2735
- artifact_type: string;
2736
- /**
2737
- * Size of the artifact in bytes
2738
- */
2739
- size_bytes: number;
2740
- }
2741
- /**
2742
- * Reference to the artifact
2743
- */
2744
- export interface ArtifactReference2 {
2745
- artifact_id: ArtifactId;
2746
- version: number;
2747
- }