-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathmodels.go
More file actions
745 lines (692 loc) · 18.7 KB
/
models.go
File metadata and controls
745 lines (692 loc) · 18.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
package database
import (
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
pgvector_go "github.com/pgvector/pgvector-go"
"github.com/speakeasy-api/gram/server/internal/conv"
"github.com/speakeasy-api/gram/server/internal/externalmcp/repo/types"
"github.com/speakeasy-api/gram/server/internal/tools/repo/models"
"github.com/speakeasy-api/gram/server/internal/urn"
)
type AgentExecution struct {
ID string
ProjectID uuid.UUID
DeploymentID uuid.NullUUID
Status string
StartedAt pgtype.Timestamptz
CompletedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ApiKey struct {
ID uuid.UUID
OrganizationID string
ProjectID uuid.NullUUID
CreatedByUserID string
Name string
KeyPrefix string
KeyHash string
Scopes []string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type Asset struct {
ID uuid.UUID
ProjectID uuid.UUID
Name string
Url string
Kind string
ContentType string
ContentLength int64
Sha256 string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type Chat struct {
ID uuid.UUID
ProjectID uuid.UUID
OrganizationID string
UserID pgtype.Text
ExternalUserID pgtype.Text
Title pgtype.Text
Resolution pgtype.Text
ResolutionNotes pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ChatMessage struct {
ID uuid.UUID
ChatID uuid.UUID
ProjectID uuid.NullUUID
Role string
Content string
ContentRaw []byte
ContentAssetUrl pgtype.Text
Model pgtype.Text
MessageID pgtype.Text
FinishReason pgtype.Text
ToolCalls []byte
PromptTokens int64
CompletionTokens int64
TotalTokens int64
StorageError pgtype.Text
UserID pgtype.Text
ExternalUserID pgtype.Text
Origin pgtype.Text
UserAgent pgtype.Text
IpAddress pgtype.Text
Source pgtype.Text
ToolCallID pgtype.Text
ToolUrn urn.Tool
ToolOutcome pgtype.Text
ToolOutcomeNotes pgtype.Text
CreatedAt pgtype.Timestamptz
}
type CustomDomain struct {
ID uuid.UUID
OrganizationID string
Domain string
Verified bool
Activated bool
IngressName pgtype.Text
CertSecretName pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type Deployment struct {
ID uuid.UUID
Seq int64
UserID string
ProjectID uuid.UUID
OrganizationID string
IdempotencyKey string
ClonedFrom uuid.NullUUID
GithubRepo pgtype.Text
GithubPr pgtype.Text
GithubSha pgtype.Text
ExternalID pgtype.Text
ExternalUrl pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type DeploymentLog struct {
ID uuid.UUID
Seq int64
Event string
Message string
DeploymentID uuid.UUID
ProjectID uuid.UUID
AttachmentID uuid.NullUUID
AttachmentType pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type DeploymentStatus struct {
ID uuid.UUID
Seq int64
DeploymentID uuid.UUID
Status string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type DeploymentsFunction struct {
ID uuid.UUID
DeploymentID uuid.UUID
AssetID uuid.UUID
Name string
Slug string
Runtime string
RunnerVersion pgtype.Text
}
type DeploymentsOpenapiv3Asset struct {
ID uuid.UUID
DeploymentID uuid.UUID
AssetID uuid.UUID
Name string
Slug string
}
type DeploymentsPackage struct {
ID uuid.UUID
DeploymentID uuid.UUID
PackageID uuid.UUID
VersionID uuid.UUID
}
type Environment struct {
ID uuid.UUID
OrganizationID string
ProjectID uuid.UUID
Name string
Slug string
Description pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type EnvironmentEntry struct {
Name string
Value string
EnvironmentID uuid.UUID
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type ExternalMcpAttachment struct {
ID uuid.UUID
DeploymentID uuid.UUID
RegistryID uuid.UUID
Name string
Slug string
RegistryServerSpecifier string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ExternalMcpToolDefinition struct {
ID uuid.UUID
ExternalMcpAttachmentID uuid.UUID
ToolUrn string
RemoteUrl string
TransportType types.TransportType
RequiresOauth bool
Type string
Name pgtype.Text
Description pgtype.Text
Schema []byte
OauthVersion string
OauthAuthorizationEndpoint pgtype.Text
OauthTokenEndpoint pgtype.Text
OauthRegistrationEndpoint pgtype.Text
OauthScopesSupported []string
HeaderDefinitions []byte
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ExternalOauthClientRegistration struct {
ID uuid.UUID
OrganizationID string
OauthServerIssuer string
ClientID string
ClientSecretEncrypted pgtype.Text
ClientIDIssuedAt pgtype.Timestamptz
ClientSecretExpiresAt pgtype.Timestamptz
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ExternalOauthServerMetadatum struct {
ID uuid.UUID
ProjectID uuid.UUID
Slug string
Metadata []byte
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type FlyApp struct {
ID uuid.UUID
Seq int64
ProjectID uuid.UUID
DeploymentID uuid.UUID
FunctionID uuid.UUID
AccessID uuid.UUID
FlyOrgID string
FlyOrgSlug string
AppName string
AppUrl string
RunnerVersion string
PrimaryRegion string
Status string
ReapedAt pgtype.Timestamptz
ReapError pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type FunctionResourceDefinition struct {
ID uuid.UUID
ResourceUrn urn.Resource
ProjectID uuid.UUID
DeploymentID uuid.UUID
FunctionID uuid.UUID
Runtime string
Name string
Description string
Uri string
Title pgtype.Text
MimeType pgtype.Text
Variables []byte
Meta []byte
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type FunctionToolDefinition struct {
ID uuid.UUID
ToolUrn urn.Tool
ProjectID uuid.UUID
DeploymentID uuid.UUID
FunctionID uuid.UUID
Runtime string
Name string
Description string
InputSchema []byte
Variables []byte
AuthInput []byte
Meta []byte
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type FunctionsAccess struct {
ID uuid.UUID
Seq int64
ProjectID uuid.UUID
DeploymentID uuid.UUID
FunctionID uuid.UUID
EncryptionKey conv.Secret
BearerFormat pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type HttpSecurity struct {
ID uuid.UUID
DeploymentID uuid.UUID
ProjectID uuid.NullUUID
Openapiv3DocumentID uuid.NullUUID
Key string
Type pgtype.Text
Name pgtype.Text
InPlacement pgtype.Text
Scheme pgtype.Text
BearerFormat pgtype.Text
OauthTypes []string
OauthFlows []byte
EnvVariables []string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type HttpToolDefinition struct {
ID uuid.UUID
ToolUrn urn.Tool
ProjectID uuid.UUID
DeploymentID uuid.UUID
Openapiv3DocumentID uuid.NullUUID
Confirm pgtype.Text
ConfirmPrompt pgtype.Text
Summarizer pgtype.Text
Name string
UntruncatedName pgtype.Text
Summary string
Description string
Openapiv3Operation pgtype.Text
Tags []string
XGram pgtype.Bool
OriginalName pgtype.Text
OriginalSummary pgtype.Text
OriginalDescription pgtype.Text
ServerEnvVar string
DefaultServerUrl pgtype.Text
Security []byte
HttpMethod string
Path string
SchemaVersion string
Schema []byte
HeaderSettings []byte
QuerySettings []byte
PathSettings []byte
RequestContentType pgtype.Text
ResponseFilter *models.ResponseFilter
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type McpEnvironmentConfig struct {
ID uuid.UUID
ProjectID uuid.UUID
McpMetadataID uuid.UUID
VariableName string
HeaderDisplayName pgtype.Text
ProvidedBy string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type McpMetadatum struct {
ID uuid.UUID
ToolsetID uuid.UUID
ProjectID uuid.UUID
ExternalDocumentationUrl pgtype.Text
LogoID uuid.NullUUID
Instructions pgtype.Text
HeaderDisplayNames []byte
DefaultEnvironmentID uuid.NullUUID
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type McpRegistry struct {
ID uuid.UUID
Name string
Url string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type OauthProxyClientInfo struct {
McpSlug string
ClientID string
ClientSecret string
ClientSecretExpiresAt pgtype.Timestamptz
ClientName string
RedirectUris []string
GrantTypes []string
ResponseTypes []string
Scope string
TokenEndpointAuthMethod string
ApplicationType string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type OauthProxyProvider struct {
ID uuid.UUID
ProjectID uuid.UUID
OauthProxyServerID uuid.UUID
Slug string
ProviderType string
AuthorizationEndpoint pgtype.Text
TokenEndpoint pgtype.Text
RegistrationEndpoint pgtype.Text
ScopesSupported []string
ResponseTypesSupported []string
ResponseModesSupported []string
GrantTypesSupported []string
TokenEndpointAuthMethodsSupported []string
SecurityKeyNames []string
Secrets []byte
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type OauthProxyServer struct {
ID uuid.UUID
ProjectID uuid.UUID
Slug string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type OpenrouterApiKey struct {
OrganizationID string
Key string
KeyHash string
MonthlyCredits int64
Disabled bool
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type OrganizationFeature struct {
ID int64
OrganizationID string
FeatureName string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type OrganizationMetadatum struct {
ID string
Name string
Slug string
GramAccountType string
SsoConnectionID pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DisabledAt pgtype.Timestamptz
}
type OrganizationUserRelationship struct {
ID int64
OrganizationID string
UserID string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type Package struct {
ID uuid.UUID
Name string
Title pgtype.Text
Summary pgtype.Text
DescriptionRaw pgtype.Text
DescriptionHtml pgtype.Text
Url pgtype.Text
Keywords []string
ImageAssetID uuid.NullUUID
OrganizationID string
ProjectID uuid.UUID
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type PackageVersion struct {
ID uuid.UUID
PackageID uuid.UUID
DeploymentID uuid.UUID
Visibility string
Major int64
Minor int64
Patch int64
Prerelease pgtype.Text
Build pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type Project struct {
ID uuid.UUID
Name string
Slug string
OrganizationID string
LogoAssetID uuid.NullUUID
FunctionsRunnerVersion pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ProjectAllowedOrigin struct {
ID uuid.UUID
ProjectID uuid.UUID
Origin string
Status string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ProjectToolVariation struct {
ID uuid.UUID
ProjectID uuid.UUID
GroupID uuid.UUID
}
type PromptTemplate struct {
ID uuid.UUID
ToolUrn urn.Tool
ProjectID uuid.UUID
HistoryID uuid.UUID
PredecessorID uuid.NullUUID
Name string
Description pgtype.Text
Arguments []byte
Prompt string
Engine pgtype.Text
Kind pgtype.Text
ToolsHint []string
ToolUrnsHint []string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type SlackAppConnection struct {
SlackTeamID string
OrganizationID string
ProjectID uuid.UUID
AccessToken string
SlackTeamName string
DefaultToolsetSlug pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type SourceEnvironment struct {
ID uuid.UUID
SourceKind string
SourceSlug string
ProjectID uuid.UUID
EnvironmentID uuid.UUID
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type ToolVariation struct {
ID uuid.UUID
GroupID uuid.UUID
SrcToolUrn urn.Tool
SrcToolName string
Confirm pgtype.Text
ConfirmPrompt pgtype.Text
Name pgtype.Text
Summary pgtype.Text
Description pgtype.Text
Tags []string
Summarizer pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ToolVariationsGroup struct {
ID uuid.UUID
ProjectID uuid.UUID
Name string
Description pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type Toolset struct {
ID uuid.UUID
OrganizationID string
ProjectID uuid.UUID
Name string
Slug string
Description pgtype.Text
DefaultEnvironmentSlug pgtype.Text
McpSlug pgtype.Text
McpIsPublic bool
McpEnabled bool
ToolSelectionMode string
CustomDomainID uuid.NullUUID
ExternalOauthServerID uuid.NullUUID
OauthProxyServerID uuid.NullUUID
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ToolsetEmbedding struct {
ID uuid.UUID
ProjectID uuid.UUID
ToolsetID uuid.UUID
ToolsetVersion int64
EntryKey string
EmbeddingModel string
Embedding1536 pgvector_go.Vector
Payload []byte
Tags []string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type ToolsetEnvironment struct {
ID uuid.UUID
ToolsetID uuid.UUID
ProjectID uuid.UUID
EnvironmentID uuid.UUID
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type ToolsetPrompt struct {
ID uuid.UUID
ProjectID uuid.UUID
ToolsetID uuid.UUID
PromptHistoryID uuid.UUID
PromptTemplateID uuid.NullUUID
PromptName string
}
type ToolsetVersion struct {
ID uuid.UUID
ToolsetID uuid.UUID
Version int64
ToolUrns []urn.Tool
ResourceUrns []urn.Resource
PredecessorID uuid.NullUUID
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}
type User struct {
ID string
Email string
DisplayName string
PhotoUrl pgtype.Text
Admin bool
LastLogin pgtype.Timestamptz
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type UserOauthToken struct {
ID uuid.UUID
UserID string
OrganizationID string
OauthServerIssuer string
AccessTokenEncrypted string
RefreshTokenEncrypted pgtype.Text
TokenType string
ExpiresAt pgtype.Timestamptz
Scope pgtype.Text
ProviderName pgtype.Text
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DeletedAt pgtype.Timestamptz
Deleted bool
}